How to run Macros in Shared workbook

G

Guest

Hi,
I have created a shared workbook, containing protected worksheets with Macros.
By wrapping the Macro codes with as follow:

Sheets("My Sheet").Unprotect("My password")
Macro Code
Sheets("My Sheet").Protect("My password")

my macros work when the Workbook(Not Shared) is on the shared drive of my
Company.
When I set it as Shared Workbook, I receive an error message.
Can Someone Help me on this matter ?

Thanks in advance

regards

Paul.
 
D

Dave Peterson

There are some things you can't do in shared workbooks. One of them is changing
the protection of a worksheet.

The only workarounds I know are:

Don't share the workbook
or
Don't protect the worksheet.

Take a look at excel's help:
Features that are unavailable in shared workbooks

And you'll a list.
 
A

Alan

Dave Peterson said:
There are some things you can't do in shared workbooks. One of them
is changing the protection of a worksheet.

The only workarounds I know are:

Don't share the workbook
or
Don't protect the worksheet.

Take a look at excel's help:
Features that are unavailable in shared workbooks

And you'll a list.

Or un-share it, run the code, and share again?

However, that will take a noticeable amount of time for the user.

HTH,

Alan.
 
D

Dave Peterson

But bad things could happen.

Change history will be gone. And any other user currently editing the file
won't be able to save their changes--even after you reshare it.
 
A

Alan

Dave Peterson said:
But bad things could happen.

Change history will be gone. And any other user currently editing
the file won't be able to save their changes--even after you reshare
it.

Good points!

Alan.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top