View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Wolf Wolf is offline
external usenet poster
 
Posts: 19
Default Add Password Using Access

Try perhaps

..close false

Wolf

"Ross" wrote:

I am try to add a password to an exported spreadsheet programmatically using
MS Access. I borrowed this code from another program and it works perpectly
except, it requires the user to enter YES to save the document.

How can I modify this code to prevent having to answer Yes to the save
changes question.

Code:
strCompleteExcelName = DestinationFolder & ExcelFileName
Set app = New Excel.Application
Set wbk = app.Workbooks.Open(FileName:=strCompleteExcelName)

With wbk

.SaveAs FileName:=DestinationFolder & ExcelFileName & ".xls", _
WriteResPassword:=ReadOnlyPassword

.Close
End With
Set wbk = Nothing

' Shut down the Excel connection.
app.Quit
Set app = Nothing

Thank you

Ross