Pookiemeister
Well-known Member
- Joined
- Jan 6, 2012
- Messages
- 640
- Office Version
- 365
- 2010
- Platform
- Windows
I'm not sure what I am doing wrong here. Sometimes when I open my worbook, I will get a Run-time error '91': Object variable or With block variable not set and sometimes I won't get it. That makes no sense but when I added the Option Explicit to the top of the code I get the error message every time.
When I step through the code, the error occurs after
Full Code below:
I'm also not sure if result should be a string and not something else.
Thank You
When I step through the code, the error occurs after
Code:
ActiveWindow.Visible = False
Code:
Option Explicit
Private Sub Workbook_Open()
Dim result As String
ActiveWindow.Visible = False
result = MsgBox("Do you want to open the product list worksheet prior to opening the userform?", vbYesNo + vbDefaultButton2, "Select Option")
If result = vbYes Then
Windows("Happy.xlsm").Visible = True
Else
selectFilefrm.Show
End If
End Sub
Code:
Dim result As String
Thank You
Last edited: