Question

MESSAGE 1 1. Using the Visual Basic Editor, create a VBA procedure named message_1 that does...

MESSAGE 1

1. Using the Visual Basic Editor, create a VBA procedure named message_1 that does the following:
a. Asks the user for their name (using an Input Box).
b. Determines the number of slides in the presentation using the appropriate code.
c. Displays a message back to the user (using a Message Box) that contains the name entered and the number of slide in the presentation. The message should be something like this: (Hello Sally, there are 8 slides in this presentation!)

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Below is the VBA code that will ask the user for name, then count the number of slides is the presentation given as path and output the result. In order to use PowerPoint presentation object you need to add the object. Follow the instruction below to add object-

1. Go to Tools -> Reference then from the dialog box check Microsoft PowerPoint 16.0 Object Libarary

2. Click ok.

Then copy paste the below code. Follow the comments for understanding.

VBA Code-

Sub message_1()
' Getting user name as input
myName = InputBox("Enter your name")
' Code to give file path to count number of slides in PPT
Dim pPath As String
Dim pCount As Integer
Dim pPowerPoint As New PowerPoint.Application
Dim pPresentation As PowerPoint.Presentation

'Full Path of your Power point presentation
pPath = ".\Team Meeting-agenda.pptx" 'For example
Set pPresentation = pPowerPoint.Presentations.Open(pPath)

'Get the total count of slides
pCount = pPresentation.Slides.Count

pPresentation.Close 'Close the power point presentation
pPowerPoint.Quit 'now quit the power point Application

'Set both the Object variables to Nothing
Set pPresentation = Nothing
Set pPowerPoint = Nothing
'Display message with total count
MsgBox "Hello " & myName & ", There are " & pCount & " slides in this presentation"

End Sub

Code screenshot-

Output (1)

Output (2)

Add a comment
Answer #2

Any doubt please comment me.

Answer)

I create a presentation with four slides and on the first slide I take a button, then write the code of VBA against that button. When the slide show start we will click on the button. single quotes(') is used for comments.

The code

Private Sub CommandButton1_Click()

'inputbox to Asks the user for their name
i = InputBox("Name", "Name", , 1, 1)
'ActivePresentation.Slides.Count is used to Determines the number of slides in the presentation
p = ActivePresentation.Slides.Count
'msgbox to display the message, and display the count, & is used for concatenation
MsgBox ("Hello " & i & ", there are " & p & " slides in this presentation!")
End Sub

Screenshot before presentation starts.

Screenshot after presentation starts. Click on the button

Add a comment
Know the answer?
Add Answer to:
MESSAGE 1 1. Using the Visual Basic Editor, create a VBA procedure named message_1 that does...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Create and call a function Using the Visual Basic Editor: create a VBA procedure named call_function...

    Create and call a function Using the Visual Basic Editor: create a VBA procedure named call_function that does the following: Prompts the user, using two input boxes, for the height and the radius of the base of a cone. Calls a function named cone_volume and passes the two values to it. Receives a value back from the function and displays it in a message to the user. Create a function named cone_volume that does the following: Receives the two values...

  • PLEASE USE VISUAL BASIC* BY VISUAL STUDIO. Visual Basic INTERMEDIATE Create a Windows Forms application. Use...

    PLEASE USE VISUAL BASIC* BY VISUAL STUDIO. Visual Basic INTERMEDIATE Create a Windows Forms application. Use the following names for the project and solution, respectively: Chopkins Project and Chopkins Solution. Save the application in the VB2017\Chap03 folder. Change the form file's name to Main Form.vb. Change the form's name to frmMain. Create the interface shown in Figure 3-37. The interface contains six labels, three text boxes, and two buttons. The application calculates and displays the total number of packs ordered...

  • Microsoft Excel VBA (Visual Basic for Applications) Programming Language Objectives: Create an array and redim it...

    Microsoft Excel VBA (Visual Basic for Applications) Programming Language Objectives: Create an array and redim it to a size equal to an assigned value of a variable, populate the array with a series of random numbers, output the array to a message box and to a worksheet. Instructions: - Review the variables already declared. You won't need others. - See comments in the code that will act as your guide. Add new code directly after each comment. - Assign a...

  • Problem 1 - Print positive message Create a new project named whatever you want in Visual...

    Problem 1 - Print positive message Create a new project named whatever you want in Visual Studio using the Windows Desktop Wizard or in Xcode. If you're using Visual Studio, add a main.c file to your project; you can use the main.c template I provided on Canvas if you'd like. If you're using Xcode, Xcode automatically generates a main.c file for you. Read in an integer from the user; don't prompt for the user input, because that will confuse the...

  • in visual basic ........Create a project that displays the aisle number of a movie category in...

    in visual basic ........Create a project that displays the aisle number of a movie category in a label. The movie categories will be in a list box. Store the aisle numbers and categories in an array. A Search button should locate the correct location from the array and display it in a label. Make sure that the user has selected a category from the list and use the list box SelectedIndex property to find the appropriate aisle number. Table Data...

  • the code is in visual basic 376 Chapter 6 Loop Structures Case Programming Assignments con Most...

    the code is in visual basic 376 Chapter 6 Loop Structures Case Programming Assignments con Most Rainfall in the USA USE CASE DEFINITION e Windows application opens with the heading "Most Rainfall in US - Kauai," a ListBox object that displays the monthly rainfall amounts, an i amounts in inches mage, and a Button object that allows the user to begin entering their rainfall 2. A menu bar displays the File menu, which has two menu items: Clear and Exit....

  • This is Visual Basic program, thank you for your help In this assignment, you'll start a...

    This is Visual Basic program, thank you for your help In this assignment, you'll start a new Windows Forms application. Assume we have the data shown below: Names_first={"jack","marjy","tom","luke","sam","al","joe","miky","lu"} Name_last={"jones","ety","fan","spence","amin",sid","bud","ant","ben"} Amounts={234.45,8293.1,943.25,27381.0,271.39,7436.12,2743.0,1639.95,2354.2} The above will allows us to emulate reading data from a file, which we will learn in the next unit. For now, we will assume the data above has been read from a file. We need to process this data in fast way. For that purpose, we need to: Declare...

  • this is assembly language for x-86 processors using microsoft visual studio Create a procedure named FindThrees...

    this is assembly language for x-86 processors using microsoft visual studio Create a procedure named FindThrees that returns 1 if an array has three consecutive values of 3 somewhere in the array. Otherwise, return 0. The procedure’s input parameter list contains a pointer to the array and the array’s size. Use the PROC directive with a parameter list when declaring the procedure. Preserve all registers (except EAX) that are modified by the procedure. Write a test program that calls FindThrees...

  • The following form will be used to determine the sales commission of employees. Using Visual Basic...

    The following form will be used to determine the sales commission of employees. Using Visual Basic Studio, build the form with these features:  The checkbox “Target Met” must be disabled.  The title of the form should appear as “Sales Commissions” Write the code to do the following: After entering the totals sales, the checkbox will automatically be checked if the average sales per month was $1,500 or more. Note: The average sales per month can be calculated by...

  • The questions below deal with Microsoft Visual Studio 2012 Reloaded, under the Visual Basic programming language....

    The questions below deal with Microsoft Visual Studio 2012 Reloaded, under the Visual Basic programming language. The book ISBN number that I am using is: 978-1-285-08416-9 or the UPC code is: 2-901285084168-1. Question 1 Visual Basic 2012 is an object-oriented programming language, which is a language that allows the programmer to use ____________________ to accomplish a program�s goal. Question 2 An application that has a Web user interface and runs on a server is called a(n) ____________________ application. Question 3...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT