ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How can I share and un-share a workbook using a macro? (https://www.excelbanter.com/excel-programming/374336-how-can-i-share-un-share-workbook-using-macro.html)

Botter

How can I share and un-share a workbook using a macro?
 
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?

Nigel

How can I share and un-share a workbook using a macro?
 
If ActiveWorkbook.MultiUserEditing Then
ActiveWorkbook.ExclusiveAccess
End If



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


--
Cheers
Nigel



"Botter" wrote in message
...
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?




Tom Ogilvy

How can I share and un-share a workbook using a macro?
 
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.

--
Regards,
Tom Ogilvy



"Botter" wrote:

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?



All times are GMT +1. The time now is 06:18 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com