What is the syntax to retrieve all open workbooks in Excel?

'wb.Name holds the name of the open workbook
Dim wb As Workbook
For Each wb In Application.Workbooks
 <code here with involving wb.Name>
Next wb
Dim wb As Workbook
For Each wb In Application.Workbooks 'for each open workbook, pass the name to lookupEGA()
   MsgBox wb.Name
   lstWorkbooks.AddItem wb.Name
Next wb



What is the syntax to change a button’s display text?

 <button name>.Caption = "<new text>"
btnPause.Caption = "Resume"


What is the syntax to load an image?

<image control name>.Picture = LoadPicture(<file path in string form>)
profileImg.Picture = LoadPicture("C:\Users\john\Documents\johnsface.jpg")

strPath = "C:\Users\bob\Pictures\Landscapes\picoftrees.jpg"
image1.Picture = LoadPicture(strPath)


Helpful Tips

  • To add an Image Control, directly drag an Image from the Toolbox menu onto your UserForm.
  • To change the name of an Image Control, go to the Properties window in the UserForm Editor and change the name under field “(Name)”.
  • If you do not see your Toolbox or Properties window, go to the top under View and toggle your visibility settings
  • To find the string filepath for your image, you may find this article helpful: How do I find the filepath for a folder?

What is the syntax to declare variables?

'to declare procedure variables
Dim <variable name> As <variable type>

‘to declare procedure variables that retains value
Static <variable name> As <variable type>

‘module variable
Private <variable name> As <variable type> 

‘global variable
Public <variable name> As <variable type>