Getting unexpected error message
Sorry, I meant to say, "When the 2nd line of code below is executed..."
"Bob" wrote:
Tom / JLGWhiz,
Prior to the lines of code I showed below, my procedure opens the workbook
and unshares it. I then modify some data within the workbook and then
re-save it.
The lines of code show below are the lines that are excuted after I have
re-saved the workbook. I need to re-share the workbook (similar to if I
clicked on Tools, Protection, Protect and Share Workbook...). When the 3rd
line of code below is executed, Excel does indeed re-share the workbook.
Afterwards, however, execution stops when I then try to Close the workbook.
Does this additional info help?
Thanks again for any assistance.
Bob
"Bob" wrote:
Near the end of my procedure (which is located in PERSONAL.XLS) , I have the
following lines of code:
Application.DisplayAlerts = False
ActiveWorkbook.ProtectSharing SharingPassword:="password"
ActiveWorkbooks.Close SaveChanges:=False
Application.DisplayAlerts = True
(Please note that my procedure starts out by opening a workbook located on a
network shared drive.)
When Excel executes the 3rd line of code above, my procedure stops and I get
the following error message:
Run-time error.
This workbook contains macros recorded or written in Visual Basic.
Macros cannot be viewed or edited in shared workbooks.
Given that Application.DisplayAlerts has been set to False, I don't
understand why the error message is appearing.
Does anyone have any ideas on how I can modify the lines above to prevent
the error message from appearing? Thanks.
|