Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

can anyone tell me how to save an excel workbook so that I can open it with readwrite privilages, but only allow readonly access to others. I have tried the following code but get the error, file is write reserved, when trying to save the file for the second time. Thanks for the help.

 

'save the file

ExcelApp.Workbooks(1).SaveAs(strFileName, , , "sa", True, False, Excel.XlSaveAsAccessMode.xlShared, , , , )

 

'open the file

ExcelApp.Workbooks.Open(strFileName, , False, , , "sa", True, , , True, , , )

Posted

i got it, here are the two statements that work

 

'to open

ExcelApp.Workbooks.Open(strFileName, , False, , , "sa", , , , , , , )

 

'to save

ExcelApp.Workbooks(1).SaveAs(strFileName, -4143, , "sa", False, False, , , , , )

 

-4143 is the value of xlnormal for fileformat

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...