`I was hoping someone could help me to understand when I can use "Me" in VBA. I've seen many code where this is used, but when I try ot use it. I get an error.
"Invalid use of the "Me" command.
Here is the current code i tried to use it in.
what I am trying to do is close out the workbook, and open the form. I tried using the Hide command which works, but when I open another workbook through the menu, It says workbook already open. So I need to close the workbook not just hide it. I also tried just using
"Workbook.close"
The problem I had with this command is that is does close the workbook, but it also closes the form. when the user click the button on the workbook to access the User menuform. I need the form to open but the workbook to close.
"Invalid use of the "Me" command.
Here is the current code i tried to use it in.
Code:
Private Sub MySub()
' from other excel file
Run "UserformExample.xlsm!ShowDataSheetForm"
Unload Me
ActiveWorkbook.Close
End Sub
what I am trying to do is close out the workbook, and open the form. I tried using the Hide command which works, but when I open another workbook through the menu, It says workbook already open. So I need to close the workbook not just hide it. I also tried just using
"Workbook.close"
The problem I had with this command is that is does close the workbook, but it also closes the form. when the user click the button on the workbook to access the User menuform. I need the form to open but the workbook to close.