Add Password Using Access

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top