How can I share and un-share a workbook using a macro?

G

Guest

I have a excel workbook that I create a barcode picture in and print it. The
information in this workbook is shared by many different users. When a
workbook is shared, pictures can not be created. I would like to unshare the
workbook, print the barcode, and the share again so that the other users can
see infomation created at this station. Can someone tell be how to share and
unshare in a macro?
 
N

Nigel

If ActiveWorkbook.MultiUserEditing Then
ActiveWorkbook.ExclusiveAccess
End If



If Not ActiveWorkbook.MultiUserEditing Then
ActiveWorkbook.SaveAs Filename:=ActiveWorkbook.FullName, _
accessMode:=xlShared
End If
 
G

Guest

With ActiveWorkbook
' .KeepChangeHistory = True ' optional
.SaveAs Filename:=.FullName, AccessMode:=xlShared
.Close
End With

or
If Not ActiveWorkbook.MultiUserEditing Then
ActiveWorkbook.SaveAs fileName:=ActiveWorkbook.FullName, _
accessMode:=xlShared
End If

-----------------------

If ActiveWorkbook.MultiUserEditing Then
ActiveWorkbook.ExclusiveAccess
End If


read the help on these methods.
 

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