January 30, 2020
Hi,
I have made Database VBA with visible sheets. After converting to down from excel 2019 to 365 office it
comes up with Runtime error 91 "Object Varible or with Block Varible not Set".
Yet when I use it in 2019 nothing happens?????
Sub VisibleTrue()
DIM ws As worksheet
For Each ws In Activeworkbook.Sheets
ws.Visible = True
Next ws
ActiveWindow.DisplayWorkbookTabs = True
Sheet9.Select
End Sub
I Also tried.
DIM As Worksheet
Set ws ActiveWorkbook
ECT.....
Have I missed something here or is it because of going from 2019 too 365
Thanks
Steve
October 5, 2010
Hi Steve,
I can't reproduce the error. When I run VisibleTrue it runs without issue.
Do you get this error when you open the workbook?
What line of code is highlighted when the error occurs?
Have you tried debugging by stepping though the code line by line using F8?
regards
Phil
January 30, 2020
Hi Phil,
Thats interesting. The error came up as soon as I transferred the database from my excel 2019 to 365 (work computer).
The error comes as soon as I hit enable editing or macro. The error indicates on VBA debug highlighted in yellow:
For Each ws In Activeworkbook.Sheets
I could bench test this tomorrow at another collueges computer and see if it debugs on that computer. All work computers run 365 - sad.
I had previously completed 3 databases and never had an issue with that visibletrue scenario coding.
Can you confirm if its a 365 or my 365 work computer or excel difference between 2019 and 365????
Thanks
Steve
Trusted Members
Moderators
November 1, 2018
Trusted Members
December 20, 2019
Trusted Members
Moderators
November 1, 2018
Trusted Members
Moderators
November 1, 2018
Steve,
My point is that if your workbook opens in protected mode and you then enable editing and macros, any code run in the Open event will not be able to access any application properties (such as Activeworkbook). If you save, close and then reopen it, so it should be trusted at that point, does the code then run without error (assuming you don't get any prompts)?
1 Guest(s)