In this post you can find Complete and recently updated Correct Question and answers of VBA. All Answers updated regularly with new questions. Upwork
test answers of 2016.
Question:* What does VBA mean?
Answer: • Visual Basic for Applications
Question:* What is the shortcut keystroke to debug VBA code one line at a time?
Answer: • F8
Question:* True or False? It is possible to name a Sub with a string containing a space.
Answer: • False
Question:* Which of these is not a Visual Basic object?
Answer: • FontSize
Question:* You've created a user form named 'Entry_Form'. To make the user form appear, use which of the following statements?
Answer: • Entry_Form.Show
Question:* On July 4, 2013, What will be displayed in the message box from the following statement: MsgBox(Format(Now,"mm-dd-yyyy"))
Answer: • 07-04-2013
Question:* Choose the VBA code that will allow you to obtain information about an error.
Answer: • Err.Description
Question:* To obtain the value of the number of characters used in a textbox field on a form, which snippet of VBA code would you use?
Answer: • Len(CStr(Forms!DataEntryfrm.Text11.Value))
Question:* To save a VBA project with an Excel workbook, the workbook must be saved as what type of file?
Answer: • xlsm
Question:* To continue to run code even if a line of code causes an error, choose the VBA code to continue to the next line of code.
Answer: • On Error Resume Next
Question:* Which of the following is not a VBA data type?
Answer: • VarChar
Question:* True or False? Commenting at the end of a line of code is permissible.
Answer: • True
Question:* To force all variables is a VBA project to be declared, which must be stated in a module?
Answer: • Option Explicit
Question:* Which of the following do not work on Excel on Mac
Answer: • ActiveX Controls
Question:* What do you need to select to set the developer mode?
Answer: • Show developer tab in the Ribbon
Question:* The tab order in a user form:
Answer: • ________ is a way to control the order in which the controls are selected using the TAB key.
Question:* The shortcut keystroke to open the VBA IDE is:
Answer: • Alt+F11
Question:* Which of the following would you begin a comment line with?
Answer: • Single quote
Question:* You can use VBA to connect to a database in SQL Server using:
Answer: • an ADODB.Connection
Question:* What is difference between a sub routine and a function.
Answer: • Function can return a value.
Question:* Which of the following snippets of VBA code is not a loop?
Answer: • Select Case... Case... Case Else... End Select
Question:* The RowSource property of a Combo Box control allows the user to:
Answer: • define the list of items, from a range of cells, to appear in a drop-down list
Question:* What does VBA stand for
Answer: • Visual Basic for Applications
Question:* What is a macro used for?
Answer: • To automatically complete a series of Excel steps
Question:* What does a VBA macro consist of?
Answer: • Computer code that performs some actions on or with objects
Question:* To comment a block of code, you must first:
Answer: • Activate the Edit toolbar in the Visual Basic Editor
Question:* Correct this statement to start a 5-iteration loop: For x = 1 to 10 Step -2
Answer: • For x = 1 to 10 Step 2
Question:* Is it possible to create an array with the lowerbound being two?
Answer: • Yes
Question:* How do you declare the variable myvar as an integer?
Answer: • Dim myvar As Integer
Question:* The 'not equal to' operator is:
Answer: • <>
Question:* Declaring a public variable allows the user to..
Answer: • Use the variable anywhere in the project in which the variable was declared
Question:* Which worksheet event can be used to run a procedure upon deleting the contents of a cell?
Answer: • Change
Question:* How do you figure out the number of items in a collection?
Answer: • Using Count property
Question:* In the statement x = "4" + "5"', x = ?
Answer: • 45
Question:* Which of the following VBA windows shows the code of the active object?
Answer: • Code window
Question:* What is the property of a cell that allows you to set the font color of the contents?
Answer: • Font.Color
Question:* Using the Select Case construct is ideal when:
Answer: • A variable can take on multiple values
Question:* What does the DoEvents do?
Answer: • Allows operation system to process other events
Question:* Which code will allow user to edit a password protected worksheet.
Answer: • Sheets("Sheet1").Unprotect Password:="Password"
Question:* The way to pass the latest values of variables between functions and procedures is identified as:
Answer: • ByRef
Question:* What is the difference between activating and initializing a user form?
Answer: • Activate will always run when showing a user form whereas Initialize will only run when showing a user form that has not been stored in memory.
Question:* Choose the VBA code that switches control from the application to the OS.
Answer: • Continue
Question:* Choose the VBA code that will allow you to verify that an Item exists in the Dictionary object Dict1.
Answer: • If xDict1.Exists("Testing") Then
Question:* To change the text displayed in a label on a form, choose the VBA code that will allow you to update the property.
Answer: • Me.Label3.Caption = "Hello"
Question:* Combine into one line: If x > 5 Then y = x - 5 End If
Answer: • If x > 5 Then y = x - 5
Question:* Dim a,b as integer What is the type of a?
Answer: • variant
Question:* Which of the following functions do not perform a calculation
Answer: • Val
Question:* The statement 'Dim a, b as Single' declares the variables a and b as what variable types?
Answer: • a as Variant; b as Single
Question:* What value is x holding after this statement is executed: x = Left("Apple",3) & Right("People", 3)
Answer: • Appple
Question:* If you want to create a definition for a custom object in VBA, which of the following would be the best choice to insert into your project?
Answer: • Class Module
Question:* Which of these statements will start a loop of exactly 20 iterations?
Answer: • For i = 2 to 40 Step 2
Question:* To change a comment in cell A1, which will do the job?
Answer: • Range("A1").Comment.Text("My Comment")
Question:* Month(#12/25/02#) will output?
Answer: • 12
Question:* Which of the following actions will NOT cause a macro to run in Excel?
Answer: • (all of these will NOT cause a macro to run in Excel)
Question:* When stepping through code as a way to see how the values in variables change, use the:
Answer: • Watch Window
Question:* You have written a function called Switch requiring the input string parameters a and b. The function will concatenate the values assigned to b and a, in that order. What line of code is needed within the function?
Answer: • Switch = b & a
Question:* What will Format(2.36, “#0.0”) output?
Answer: • “2.4”
Question:* What is the right syntax to raise your custom error?
Answer: • Err.Raise Number:=999, Description:="My custom error"
Question:* In the next statement: "Dim bValue as Boolean" What will be the default value for "bValue" variable?
Answer: • False
Question:* What is BOF?
Answer: • A property of the Recordset object.
Question:* The library to make ADODB.connection work.
Answer: • Microsoft Active X Data Objects
Question:* 'Do While x < 5' is equivalent to:
Answer: • Do Until x >= 5
Question:* Under which menu option in the VBA IDE can you password protect a VBA project?
Answer: • Tools>VBAProject Properties
Question:* What is the difference between these commands CreateObject("Word.Application") GetObject(, "Word.Application")
Answer: • CreateObject always creates a new object. GetObject throws an error if no object of the class exists.
Question:* Choose the VBA code to execute a Word MailMerge in Access
Answer: • objWord.MailMerge.Execute
Question:* As an alternative to the If.. Then.. ElseIf..Else condition, how would you format the Choose function with variable x1 and the following conditions: "Red", "Blue", "Yellow", "White"
Answer: • Choose(x1,"Red","Blue","Yellow","White")
Question:* When integrating Excel, instead of adding a reference, which VBA code would you use to open Microsoft Excel.
Answer: • Set xlapp = CreateObject("Excel.Application")
Question:* What stores Excel data?
Answer: • Variable
Question:* When integrating Excel, which VBA code will allow you transfer data from recordset xRec in Access directly onto a spreadsheet (xlws) in Excel.
Answer: • xlws.range("A1").CopyFromRecordset xRec
Question:* True or False? An 'If-Then' statement must always be paired with an 'End If'.
Answer: • False
Question:* Which of the following snippets of VBA code will allow you to return the first array index in the array xItems?
Answer: • LBound(xItems)
Question:* Choose the VBA code used to add a new record to the recordset xRec.
Answer: • xRec.AddNew
Question:* Choose the VBA code to remove data from Row 2 in a multiple column listbox.
Answer: • Me.List0.RemoveItem 1
Question:* With out creating a reference to the Microsoft Scripting Runtime for the DLL to create a Dictionary object, choose the VBA code to allow you to do so.
Answer: • CreateObject("Scripting.Dictionary")
Question:* Choose the VBA code that you would use to obtain the user login on a computer using a Windows operating system.
Answer: • Environ("Username")
Question:* The application property that will assign a shortcut key to run a macro is:
Answer: • OnKey
Question:* Which Will Not display VBA code?
Answer: • VBA view
Question:* In Access, which VBA code will allow you to suppress alerts when deleting records from a table.
Answer: • DoCmd.SetWarnings False
Question:* Which function will allow you to convert a value to number?
Answer: • CLng
Question:* Is it possible to expand storage space for dynamic Array variables with two or more dimensions, keeping the existing data?
Answer: • Yes, by changing the size of only the last dimension.
Question:* Where you can create you custom events?
Answer: • Classes and userforms but not in modules
Question:* You want to dump the values stored in a 12-element array named Rates into the cell range A1:A12. How can you get that done?
Answer: • Range("A1:A12") = Application.WorksheetFunction.Transpose(Rates)
Question:* Choose the VBA code to filter the rowsource in a multiple column listbox that will allow you to filter the records listed using the LIKE statement and the variable xCompany.
Answer: • Me.List0.RowSource = "SELECT * FROM tblOrders WHERE Company LIKE '*" & xCompany & "*'"
Question:* What will Format(“A123”, “&&&&&&”) output?
Answer: • “A123”
Question:* Which statement will assign a random integer from 1 to 5 to the variable x?
Answer: • x = Int(Rnd * 5) + 1
Question:* Without using SQL, choose the VBA code to allow you to delete the table Employees.
Answer: • CurrentDb.TableDefs.Delete "Employees"
Question:* Choose the VBA code that will allow you to check to see if the form MainMenufrm is loaded.
Answer: • If CurrentProject.AllForms("MainMenufrm").IsLoaded Then
Question:* When you have added a new linked table using VBA code and it does not appear in Navigation Pane that displays the list of tables, forms, macros, and queries in the database. Which VBA code would you use to update the list of database objects displayed in the Navigation Pane.
Answer: • Application.RefreshDatabaseWindow
Question:* Choose the VBA code that you would use to call a public function named VBAFunction from a form called FormA while passing a variant x1 in the module of FormB form.
Answer: • Forms!FormA.VBAFunction(x1)
Question:* The ____________ allow(s) for multiple controls in a user form, to execute the same sub.
Answer: • class module
Question:* Output of below code: Dim a As Integer Dim b As Integer a = 1000 b = 33 MsgBox a * b
Answer: • Run-time error '6': Overflow
Question:* Which is NOT a method of the Workspace object:
Answer: • Activate
Question:* Out put of below code: Dim a As Single Dim b As Single a = 7 b = 2 MsgBox a / b & ", " & a \ b
Answer: • 3.5, 3
Question:* To remove the records listed in a subform, which property and value would you need to add to your VBA code.
Answer: • RecordSource = ""
Question:* Choose the VBA code used to close database and the Microsoft Access instance.
Answer: • Docmd.Quit
Question:* What is a result of this code? Sub Test() Dim myNumber As Double myNumber = -10.635 Debug.Print Fix(myNumber) Debug.Print Int(myNumber) End Sub
Answer: • -10 -11
Question:* Which tools should be used to compile the program?
Answer: • Package & Deployment Wizard
Question:* What is the short cut to get Immediate Window
Answer: • Ctrl + G
Question:* To change the font color a textbox field, choose the VBA code that will allow you change the control's property.
Answer: • Me.Text11.ForeColor = vbRed
Question:* Which of the following would NOT be a good use for a macro?
Answer: • Computing statistical calculations on data
Question:* A VBA unit is called a _____.
Answer: • Program
Question:* What reference will you add to add active x objects ,i.e. buttons, at runtime?
Answer: • Microsoft Visual Basic for Applications Extensibility Library
Question:* Choose the VBA code to allow you to obtain the value from Row 2 and Column 3 of a mutliple column listbox.
Answer: • Me.List0.Column(2,1)
Question:* Choose the function used to send an table's contents in Excel format by email from Access.
Answer: • Docmd.SendObject(acSendTable, "tblEmployees", acFormatXLS, "Sally Moore;")
Question:* To create one array variable to store monthly mortgage rates over the course of a year, the following is the best declaration statement.
Answer: • Dim Rates(1 to 12) as Single
Question:* To concatenate two lines of VBA code into one line, insert which character between the two joined lines?
Answer: • :
Question:* In order to prevent users from deleting database objects displayed in the Navigation Pane, what VBA code would be used?
Answer: • Docmd.LockNavigationPane True
Question:* To return the value of the Access database file's path, what VBA code will retrieve the value?
Answer: • CurDir
Question:* How can we declare a subroutine or function in VBA?
Answer: • Public, Private, Friend
Question:* What is a Collection object?
Answer: • An ordered set of items
Question:* In the statement 'x = 400 * y', what is the maximum value that y can be if x has been declared as in Integer?
Answer: • 81
Question:* What is PlainText ?
Answer: • A method
No comments:
Post a Comment