Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 152
Default Add Password Using Access

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
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

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Password protection/access kefee85 Excel Discussion (Misc queries) 2 May 14th 09 09:34 PM
access password to worksheet mrt Excel Worksheet Functions 3 September 1st 06 10:19 PM
access password Capt.Scott Excel Programming 1 January 7th 05 06:41 PM
Password to get access to certain sheet Jonsson Excel Programming 1 January 10th 04 03:46 PM
Password to access a worksheet tholman[_2_] Excel Programming 1 November 9th 03 03:17 PM


All times are GMT +1. The time now is 02:21 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"