WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

OLE with Excel
plus

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Open Password Protected Excel file via OLE


Question:

Anyone have an example of opening an Excel document on a command line that is password protected as an OLE call?

Question:

Using the Excel Open Method:
expression.Open(FileName, UpdateLinks, ReadOnly, Format, Password, WriteResPassword, IgnoreReadOnlyRecommended, Origin, Delimiter, Editable, Notify, Converter, AddToMru, Local, CorruptLoad, OpenConflictDocument)
FileName
Required String. The file name of the workbook to be opened.

Password
Optional Variant. A string that contains the password required to open a protected workbook. If this argument is omitted and the workbook requires a password, the user is prompted for the password.

objExcel             = ObjectOpen("Excel.Application")
objExcel.Visible     = @TRUE
objExcel.UserControl = @TRUE
objWbk = objExcel.Workbooks

objWbk.Open(::filename = "C:\Temp\Data\PswdProtected.xls", Password = "please")

Pause("Debugging","File should now be opened")

objWbk.Close
objExcel.Quit
ObjectClose(objWbk)
ObjectClose(objExcel)

Article ID:   W16105
File Created: 2004:03:30:15:42:54
Last Updated: 2004:03:30:15:42:54