lezawang
Well-known Member
- Joined
- Mar 27, 2016
- Messages
- 1,805
- Office Version
- 2016
- Platform
- Windows
Hi
I got error message running the second sub. I thought x would be visible to consequence subs but I guess that is not the case. How can I make x visible to all other subs? Thank you.
Sub workbooksoepn()
Dim x As Workbook
Set x = Workbooks.Open("C:\Users\userme\Desktop\abc.xlsx")
End Sub
Sub protecttheopenfile()
x.Protect
End Sub
I got error message running the second sub. I thought x would be visible to consequence subs but I guess that is not the case. How can I make x visible to all other subs? Thank you.
Sub workbooksoepn()
Dim x As Workbook
Set x = Workbooks.Open("C:\Users\userme\Desktop\abc.xlsx")
End Sub
Sub protecttheopenfile()
x.Protect
End Sub