Code to share a file

  • Thread starter Thread starter iashorty
  • Start date Start date
I

iashorty

I have written a macro to take one sheet from the file and save it. It is
password protected and I need to have it shared. How do I include the sharing?

OpOutputSave = Sheet3.Range("B35")
Sheets(Array("sheet 1", "sheet 2")).Select
Sheets("Sheet 2").Activate
Sheets(Array("Sheet 1", "sheet 2")).Copy
Sheets("Sheet 2").Select
Sheets("Sheet 2").Move Before:=Sheets(1)
ActiveWorkbook.SaveAs Filename:=OpOutputSave, FileFormat:=xlNormal _
, Password:="", WriteResPassword:="", ReadOnlyRecommended:=False, _
CreateBackup:=False
ActiveWindow.Close
 
from:
ActiveWorkbook.SaveAs Filename:=OpOutputSave, FileFormat:=xlNormal _
, Password:="", WriteResPassword:="", ReadOnlyRecommended:=False, _
CreateBackup:=False

to:

ActiveWorkbook.SaveAs Filename:=OpOutputSave, FileFormat:=xlNormal _
, Password:="", WriteResPassword:="", ReadOnlyRecommended:=False, _
CreateBackup:=False, AccessMode:=xlShared
 
Thank you. And what would the code be to take it off when I go to use it.

Workbooks.Open Filename:=Filename, ReadOnly:=False, Password:=""

where Filename has been determined.

IAShorty
 
XlSaveAsAccessMode can be one of these XlSaveAsAccessMode constants.

xlExclusive (exclusive mode)
xlNoChange default (don't change the access mode)
xlShared (share list)

If this argument is omitted, the access mode isn't changed. This argument is
ignored if you save a shared list without changing the file name. To change
the access mode, use the ExclusiveAccess method.
 
Back
Top