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

  • Thread starter Thread starter Guest
  • Start date Start date
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?
 
If ActiveWorkbook.MultiUserEditing Then
ActiveWorkbook.ExclusiveAccess
End If



If Not ActiveWorkbook.MultiUserEditing Then
ActiveWorkbook.SaveAs Filename:=ActiveWorkbook.FullName, _
accessMode:=xlShared
End If
 
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.
 
Back
Top