Respuestas y preguntas sobre la evaluación de habilidades de LinkedIn: Visual Basic para aplicaciones (Vba)
“Visual Basic for Applications (Vba) se ha convertido en un lenguaje de automatización de macros potente y versátil que se utiliza en las aplicaciones de Microsoft Office., Permitir a los desarrolladores crear soluciones personalizadas y optimizar tareas repetitivas.. En esta guía completa, Estamos emocionados de presentar una colección seleccionada de preguntas de evaluación de habilidades y respuestas para Vba.
Whether you’re a seasoned developer looking to enhance your skills or a beginner aiming to understand the basics of this powerful language, Este recurso está diseñado para ayudarle a adquirir competencia en Vba y sus aplicaciones. Únase a nosotros mientras exploramos los conceptos centrales de Vba, including event handling, object models, depuración, y más, empowering you to leverage the full potential of this essential tool for your Microsoft Office automation needs.”
Q1. Which two sets of values are printed by this function and sub?
Function GetVitals(ID As Long, Age As Long, Optional Weight As Long) As String
GetVitals="ID=" & ID &"Age=" & Age & "Weight=" & Weight
End Function
Sub ShowVitals()
Dim ID As Long, Age As Long,Weight as Long
Debug.Print GetVitals(ID:=5,Age:=20)
Debug.Print GetVitals(ID:=6,Age:=25,Weight:=130)
End Sub
- :
ID=5 Age = 20 Weight=
ID=6 Age = 25 Weight=130
- :
ID=5 Age = 20 Weight=0
ID=6 Age = 25 Weight=130
- :
ID=5 Age = 20 Weight=Null
ID=6 Age = 25 Weight=130
- :
ID=5 Age = 20
ID=6 Age = 25 Weight=130
This code shows the first statement of CalledSub. Which calling statement will work properly?
Q2.Sub CalledSub(Surname, Age)
- call Calledsub “smith”,26
- calledsub (surname=”smith”, Age = 26)
- calledsub (Surname:=”Smith”, Edad:=26)
- calledsub “smith”, 26
What is the principal difference between a class and an object?
Tercer trimestre.- There is no meaningful difference. The terms are used interchangeably.
- A class declares an object’s properties. An object completes the declaration by defining events and methods.
- An object is a template for a class.
- A class describes the design of an object. An object is an instance of that design.
What value does the MsgBox statement display?
Cuarto trimestre.Sub MySub(VarA As Long, ParamArray VarB() As Variant)
MsgBox VarB(0)
End Sub
Sub ShowValue()
Call MySub(10, "First arg", 2, 3.1416)
End Sub
- 2
- 10
- First arg
- 3.1416
What object is needed to put a userform module in a VBA project?
Q5.- associated standard code module
- UserForm
- associated class module
- userForm class
What is the output?
Q6.Sub UseSum()
Dim TestArray() As Integer, Total As Integer
ReDim TestArray(1)
TestArray(1) = 6
ReDim TestArray(2)
TestArray(2) = 3
Total = WorksheetFunction.Sum(TestArray)
End Sub
- 3
- 0
- 9
- 6
The Driver subroutine is declared by Sub Driver (Y). Which statement results in a compile error?
Q7.- Driver x
- call Driver(X)
- call Driver x
- Driver (Distribución de probabilidad)
You have several variables to display on a user form, and there are too many variables to display at once. Which control best enables the user to see all the variables?
Q8.- Frame
- multipage
- TabStrip
- ListBox
Below is a function named SquareIt. Which version of the subroutine named Area results in a compile error?
Q9.Function SquareIt(ByRef Basis As Integer) As Long
SquareIt = Basis ^ 2
End Function
- sub Area()
Dim Result As Long, Side As Integer
Side = 5
Result = Squarelt(Side)
End Sub
- Sub Area()
Dim Result As Long, Side
Side = 5
Result = SquareIt(Cint(Side))
End Sub
EmailAddress() is an array. It is declared by Dim EmailAddress(10) As String, and option Base 1 is in effect. How many rows and columns are in EmailAddress()?
Q10.- 10 rows and 10 columnas
- 10 rows and 1 column
- 10 rows and 0 columnas
- 1 row and 10 columnas
Which cell is selected if you run this code?
tecnicos.Range("E3:312").Range("B3").Select
- F5
- F3
- B3
- E3
Which variable name is valid in VBA?
Q12.-
_MyVar
-
My_Var
-
My-Var
-
1MyVar
Use the following rules when you name procedures, constants, variables, and arguments in a Visual Basic module: You must use a letter as the first character. You can't use a space, period (.), exclamation mark (!), or the characters @, &, $, # in the name. Name can't exceed 255 characters in length.
Which is a valid definition of a user-defined data type?
P13.- :
Type CBC
Name As String
Next As String
End Type
- :
Type CBC
Name As String
_Next As String
End Type
- :
Type CBC
Name As String
@Option As String
End Type
- :
Type CBC
Name As String
%For As String
End Type
What is one way to duplicate a user form from one project into a different project?
Q14.- :
- Save and close the project with the existing user form.
- Click Insert > Expediente.
- Browse to the location of the existing project.
- Right-click it and select the user-form you want to duplicate.
- :
- Open the existing user form in Desing Mode.
- Right-click the form and select Copy.
- Switch to the other project.
- Right-click Module and select Paste.
- :
- In the Project Explorer, right-click the user form and select Copy.
- Switch to the new project.
- Right-click UserForms and select Paste.
- :
- Open the existing user form in Design Mode.
- Haga clic en Archivo > Export File.
- Switch to the other project.
- Haga clic en Archivo > Import File.
The recording of a macro in Word is likely to be an incomplete record of the user’s actions. Por qué?
P15.- Word’s Macro Recorder does not record actions initiated by keyboard shortcuts.
- Word’s Macro Recorder does not support Find & Replace edits.
- Word’s Macro Recorder does not record actions initiated by clicking a button on the Ribbon’s Developer tab.
- Word’s Macro Recorder does not record actions that inlove the selection of text by pointing with the mouse pointer.
Which statement should precede a subroutine’s error handler?
Q16.- Fin
- Return
- Exit Sub
- Detener
How many values can MyArray hold?
P17.Option Base 0
Sub BuildArray()
Dim MyArray(5) As Integer
- 0
- 32,769
- 5
- 6
P18. Qué afirmación es verdadera?
- Set establishes a value in a class; Let returns a value from a class.
- Let establishes a value in a class; Set returns a value from a class.
- Let establish a value in a class; Get returns a value from a class.
- Get establishes a value in a class; Set returns a value from a class.
A declaration has a scope, which has three levels. What are they?
Q19.- Módulo, Project and Automation
- Procedure, Private Module and Public Module
- Subroutine, Module and Project
- Procedure, Project and Global
There are two references that must be selected in the Visual Basic Editor in order for any Visual Basic code to run in Excel. What are these two references?
P20.- MS Excel object library and MS Office object library
- VBA and MS Office object library
- VBA and Excel object library
- MS Excel object library and OLE automation
Which action will cause your project to reset its variables?
P21.- Edit the list of arguments of the current routine while in debug mode.
- Click End in a run-time error dialog.
- Add an ActiveXcontrol to a worksheet.
- todas estas respuestas
Which keyboard shortcut causes VBE to locate the declaration of a procedure?
P22.- Shift+F3
- Alt+F (Ventanas) or Option+F (Mac)
- Shift+F2
- Ctrl+F (Ventanas) or Command+F (Mac)
When you define a new class of object, where do you assign a name to it?
Q23.- in the class module’s name
- in the class module’s code
- in a standard module’s code
- in a standard module’s Properties
How does a class module indicate that it uses a particular interface?
P24.- The interface itself is part of the class module.
- by means of the Interface keyword and the name of the interface
- by means of the Implements keyword and the name of the interface
- The name of the interface is passed as a parameter.
What is needed for the contents of Module1 to be available to other modules in a VBA project, but not to any other VBA project?
P25.- Set Option Global at the top of Module1
- Declare module-level variables as Private
- Set Module Level Scope at the top of Module1
- Set Option Private Module at the top of Module1
When used with an array named MyArray, what is the preferred way to set the beginning and ending values of a loop control variable?
Q26.- For i = 0 To UBound(MyArray,1)
- For i = 1 To UBound(MyArray,1)
- For i = LBound(MyArray,1) To UBound(MyArray,1)
- It depends on whether Option Base 0 or Option Base 1 is in use.
What is the value of Test3?
Q27.Enum TestEnum
Test1
Test2
Test3
End Enum
- 0
- 1
- 3
- 2
Which statement declares an array?
P28.- Dim MyArray() As Integer
- Dim MyArray() As Array
- Dim MyArray As Integer
- Dim MyArray As Array
To use VBA code to maintain a different VBA project, you can make use of VBA’s extensibility. What is needed to enable extensibility?
Q29.- Set Macro Security to Trust Access to the VBA Project Object Model
- The project’s workbook should be protected in the Ribbon’s Review tab
- Include a reference to Microsoft VBA Extensibility 5.3
- Include a reference to Microsoft VBA Extensibility 5.3 and set Macro Security to Trust Access to the VBA Project Object Model
How do you add a user form to a VBA project?
Q30.- :
- Select the project in the Project window of the Visual Basic Editor
- Click the Design Mode button and select Insert Mode
- :
- Select the project in the Project window of the Visual Basic Editor
- Click the Toolbox button and select UserForm
- :
- Select the project in the Project window of the Visual Basic Editor
- Right-click the Run menu and select Customize
- :
- Select the project in the Project window of the Visual Basic Editor
- Click Insert > UserForm
Explicit variable declaration is required. MyVar is declared at both the module and the procedure level. What is the value of MyVar after first AAA() and then BBB() are run?
P31.Dim MyVar As String
Sub AAA()
Dim MyVar As String
MyVar = "Procedure AAA Scope"
End Sub
Sub BBB()
MyVar = "Procedure BBB Scope"
End Sub
- MyVar equals “Procedure AAA Scope”
- ISNULL(MyVar) is TRUE
- MyVar equals “Procedure BBB Scope”
- MyVar is NULL
Which code block from class modules returns a compile error?
Q32.- :
Public Property Get HDL() As Double
HDL = pHDL
End Property
Public Property Let HDL(Value As Double)
pHDL = Value
End Property
- :
Property Get HDL() As Double
HDL = Value
End Property
Property Let HDL(Value As Double)
pHDL = Value
End Property
- :
Public Property Get HDL() As Double
HDL = Value
End Property
Public Property Let HDL(Value As Double)
pHDL = Value
End Property
- :
Public Property Get HDL() As Single
HDL = pHDL
End Property
Public Property Let HDL(Value As Double)
pHDL = Value
End Property
If VBA code declares FileCount as a constant rather than a variable, the code tends to run faster. Por qué es esto?
para celebrar el éxito y resaltar las áreas de oportunidad.- The scope of constants is limited to the procedure that declares them
- Constants are declared at compile time, but variables are declared at run time
- Once declared in a project, the value of a constant cannot be changed. There is no need to look up the current value of FileCount when it is a constant.
- The Const declaration specifies the most efficient type given the constant’s value
A VBA project must declare four classes. How many class modules are needed?
P34.- dos (one for the properties and one for the methods)
- uno (each class is declared in the same module)
- cuatro (one for each class)
- as many as are required by the variable types that the objects return
What does this code display?
entonces solo habrá falla si el defecto ocurre en cada capa y estas están todas alineadas al mismo tiempo.Sub MakeErrors()
Dim Y As Variant, Z As Variant
On Error Resume Next
Y = 1 / 0
MsgBox "Y = " & Y
On Error GoTo 0
Z - (0 - 3) ^ 0.5
MsgBox "Z = " & Z
End Sub
- an error message
- Y and Z
- Z = in a message box and then a subsequent error message
- Y = in a message box and then a subsequent error message
The VBA code block shown in the following four options runs when UserForm1’s CommandButton1 button is clicked. Which block of code leaves UserForm1 loaded but not visible until the FoundErrors function has checked it, and then enables processing to continue if no errors are found?
Q36.- :
Private Sub CommandButton1_Click()
If FoundErrors(Me) Then _
Me.Show
End Sub
- :
Private Sub CommandButton1_Click()
If Not FoundErrors(UserForm1) Then _
Unload UserForm1
End Sub
- :
Private Sub CommandButton1_Click()
Me.Hide
Do While FoundErrors(Me)
Me.Show
Loop
End Sub
- :
Private Sub CommandButton1_Click()
Do While FoundErrors(UserForm1)
UserForm1.show
Loop
End Sub
The first requirement is to make UserForm1 loaded but not visible, por lo tanto, we need Me.Hide, Me in here referring to UserForm1
Which is the correct way to structure a With block?
P37.- :
With Selection
&TypeText Text:="8/24/2019"
&TypeParagraph
&TypeText Text:="1161 Alamosa Drive"
End With
- :
With Selection
.TypeText Text:="8/24/2019"
.TypeParagraph
.TypeText Text:="1161 Alamosa Drive"
End With
- :
With Selection
TypeText Text:="8/24/2019"
TypeParagraph
TypeText Text:="1161 Alamosa Drive"
End With
- :
With Selection:
&TypeText Text:="8/24/2019"
&TypeParagraph
&TypeText Text:="1161 Alamosa Drive"
End With
Why does this code generate a “Subscript out of range” error?
P38.Sub Example()
Dim MyArr() As Variant
ReDim MyArr(3, 4)
'some code
ReDim Preserve MyArr(4, 4)
End Sub
- Arrays cannot be resized more than once.
- MyArr was originally declared with three “filas”.
- You can resize only the last dimension of an array when you specify
ReDim Preserve
. - The correct syntax is
ReDim Preserve MyArr(0 To 4, 0 To 4)
.
Which subroutine declaration does not cause a compile error?
P39.-
Sub Called(Salary As Long, ParamArray Vals() As Variant)
-
Sub Called(ParamArray Vals() As Variant, Salary As Long)
-
Sub Called(Optional Salary As Long, ParamArray Vals() As Variant)
-
Sub Called(Salary As Long, ParamArray Vals() As String)
How can a user enter data on a worksheet or document, or switch windows, while UserForm1 is displayed on the screen?
Q40.- Show the form with this statement:
UserForm1.Show vbModal
- Include this statement in the code:
UserForm1.Hwnd = False.
- Set the user from’s
SpecialEffect
property tofrmShowModal
- Set the user from’s
ShowModal
property to False.
SubA passes MyVar to SubB. How can you ensure that MyVar has its original value when control returns to SubA?
P41.- Declare SubB as Sub SubB(ByRef MyVar).
- Declare SubB as Sub SubB(MyVar).
- Declare SubB as Sub SubB(Static MyVar).
- Declare SubB as Sub SubB(ByVal MyVar).
Which procedure declaration is syntactically correct?
P42.- :
Sub MySub(VarA As String, Optional VarB _
As Variant, Optional VarC As Long)
- :
Sub MySub(VarA As String, Optional VarB _
As Variant, VarC As Long)
- :
Sub MySub(Optional VarA As String, Optional VarB _
As Variant, VarC as Long)
- :
Sub MySub(OPtional VarA As String, VarB _
As Variant, Optional VarC as Long)
What are the two principal kinds of procedures in VBA?
Q43.- Function and Event
- Function and Scope
- Subroutine and Event
- Subroutine and Function
Which code block compiles without error?
Q44.-
Sub Decs() Dim MyFixed As String * 0 MyFixed = "A" MsgBox MyFixed End Sub
-
Sub Decs() Dim MyInt% * 1 MyInt = 7 MsgBox MyInt End Sub
-
Sub Decs() Dim MyInt% As Integer * 1 MyInt = 5 MsgBox MyInt End Sub
-
Sub Decs() Dim MyInt, MyNum As Integer MyInt = "A" MsgBox MyInt End Sub
What is used in the Immediate window to display the current value of the variable CountValues?
P45.-
= CountValues= CountValues
-
| CountValues| CountValues
-
: CountValues: CountValues
-
? CountValues? CountValues
At which level can you declare a variable in this way: Private TopSecret As String?
Q46.- función
- módulo
- subroutine
- procedure
How can a user enter data on a worksheet or document, or switch windows, while UserForm1 is displayed on the screen?
P47.- Show the form with this statement: UserForm1.Show vbModal.
- Set the user form’s SpecialEffect property to frmShowModal.
- Include this statement in the code:
UserForm1.Hwnd = False.
- Set the user form’s ShowModal property to False.
SubA passes MyVar to SubB. How can you ensure that MyVar has its original value when control returns to SubA?
Q48.- Declare SubB as Sub SubB(Static MyVar).
- Declare SubB as Sub SubB(ByVal MyVar).
- Declare SubB as Sub SubB(MyVar).
- Declare SubB as Sub SubB(ByRef MyVar).
Arrays cannot be resized more than once.
Q49.Sub Example() Dim MyArr() As Variant ReDim MyArr(3, 4) 'some code ReDim Preserve MyArr(4, 4)
End Sub Sub Example() Dim MyArr() As Variant ReDim MyArr(3, 4) 'some code ReDim Preserve MyArr(4, 4) End Sub
- The correct syntax is ReDim Preserve MyArr(0 A 4, 0 A 4).
- You can resize only the last dimension of an array when you specify ReDim Preserve.
- MyArr was originally declared with three “rows.”
- Declare SubB as Sub SubB(ByRef MyVar).
Which block of code ends with the variable i equal to 5 and the variable X equal to 10?
Q50.- :
Do
X = X + 1
i = i + 1
Loop Until i < 5
End Sub
- :
Sub Loopi()
Dim X As Integer, i As Integer
For i = 1 To 5
X = X + 1
Next I
End Sub
- :
Sub Loopi()
Dim X As Integer, i As Integer
Do Until i < 5
X = X + 1
i = i + 1
Loop
End Sub
- :
Sub Loopi()
Dim X As Integer, i As Integer
Do
X = X + 1
i = i + 1
Loop While i < 5
End Sub
How does a class module indicate that it uses a particular interface?
P51.- by means of the Implemets keyword and the name of interface.
- bymeans of the ¿Qué es Azure Databricks? keyword and the name of the interface.
- The name of the interface is passed as a parameter.
- The interface itself is part of the class module.
Which part of the VBE can help you explore VBA syntax?
Q52.- Locals windows
- object browser
- project explorer
- optional dialog
This code is trying to establish a new collection consisting of employee names and numbers. Assoc is a class. What statement is missing from the code?
Q53.Dim Associates As Collection, Assoc As CAssoc, i As Byte
For i = 1 To 200
Set Assoc = New CAssoc
Assoc.Name = Cells(i,1)
Assoc.Number = Cells(i,2)
Associates.Add Assoc
Next i
-
Set Associates = New Collection
-
Set Associates = Collection
-
Redim(Associates(Associates.Count+1))
-
Redim(Associates _ (Unbound(Associates)+1))
What is the standard term for a variable or value that is passed from one subroutine or function to another?
Q54.- referencia
- elemento
- argumento
- atributo
What is the standard term for a variable or value that is passed from one subroutine or function to another?
Q55.- referencia
- elemento
- argumento
- atributo
Where is the event procedure named Worksheet_Change found?
P56.- in any standard code module
- in the worksheet’s object module
- in the Worksheet_Change class module
- in the workbook’s code module
You are building an event procedure for a worksheet, and you edit the argument list in the event procedure’s Sub statement. What happens when the event procedure runs?
P57.- There’s no difference compared to the results of a standard procedure.
- The results are unpredictable.
- The procedure won’t compile.
- The procedure throws a run-time error.
Based on this code, which procedure calls the subroutine SumCosts correctly?
P58.Sub Sumosts(AcctName As String, Amount As Long)
Range("A1") = AcctName
End Sub
- call SumCosts “Totalcosts”, 3
- SumCosts “Totalcosts”, 3
- SumCosts(“Totalcosts”, 3)
- Call SumCosts
You want to declare an object that describes cars so that your VBA code can apply tests such as the following. What keyword do you use to declare Cars?
Q59.If Cars(1).Make="Ford" And Cars (1).MPG > 20
Then Cars(1).Selected = True
- Dataframe
- Tipo
- objeto
- Variant
What is the purpose of the .Range(“A1:E5”).Select portion of this statement?
Q60.ActiveCell.Offset(3,4).Range("A1:E5").Select
- If specifies the range that is to be selected after the offset is found
- it specifies the range of cells in which the contents of the offset are to be written
- It provides Resize information – en este caso, the offset returns a reference of five rows and five columns
- It specifies the range of cells at which the offset is to be based
what is the effect of the two statements below?
Q61. en excel,Range("b3:f5, c4:d9").Select
Range("b3:f5", "c4:d9").Select
- If specifies the range that is to be selected after the offset is found
- it specifies the range of cells in which the contents of the offset are to be written
- It provides Resize information – en este caso, the offset returns a reference of five rows and five columns
- It specifies the range of cells at which the offset is to be based
What does VBA stand for in the context of programming?
P62.- Very Basic Application
- Visual Basic Application
- Volatile Business Automation
- Visualized Binary Algorithm
Deja una respuesta
Debes iniciar sesión o registro para agregar un nuevo comentario .