Home All Groups Group Topic Archive Search About

Unshare an Excel sheet with VB.Net

Author
25 Mar 2005 12:50 AM
Erik Foreman
I use the line

XLwkb.ExclusiveAccess()

to unshare the workbook and it works. the problem is it sends up a
prompt for confirmation. When I run this there will be noone around to
confirm it. how do we unshare the workbook without being prompted to
confirm.

I tried
        XLwkb.ExclusiveAccess() = True
and that did not work.
I tried
        XLwkb.ExclusiveAccess(True)
and
        XLwkb.ExclusiveAccess(1)
both those said invalid number of parameters.


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Author
28 Mar 2005 7:38 PM
Paul Clement
On Thu, 24 Mar 2005 16:50:44 -0800, Erik Foreman <E***@devedx.com> wrote:

¤ I use the line
¤
¤ XLwkb.ExclusiveAccess()
¤
¤ to unshare the workbook and it works. the problem is it sends up a
¤ prompt for confirmation. When I run this there will be noone around to
¤ confirm it. how do we unshare the workbook without being prompted to
¤ confirm.
¤
¤ I tried
¤         XLwkb.ExclusiveAccess() = True
¤  and that did not work.
¤ I tried
¤         XLwkb.ExclusiveAccess(True)
¤ and
¤         XLwkb.ExclusiveAccess(1)
¤ both those said invalid number of parameters.
¤

Try changing the DisplayAlerts property of the Application object to False. Just remember to set it
back to True when finished.


Paul
~~~~
Microsoft MVP (Visual Basic)
Author
22 Mar 2007 8:20 PM
Phil
Paul, thank you for this post!  It allowed me to get around the prompting issue and now everything works great. From http://www.developmentnow.com/g/38_2005_3_0_0_370068/Unshare-an-Excel-sheet-with-VB-Net.htm Posted via DevelopmentNow.com Groups http://www.developmentnow.com