davidam
asked on
VBS not opening file and copying range
Hello Experts,
I have some vbs which is supposed to open a password protected file, copy a range from another file and then close and save the target file. I cannot see why it is not working. Can anyone spot it? The code works up until the point where it is supposed to open and modify the file. Thank you in advance.
I have some vbs which is supposed to open a password protected file, copy a range from another file and then close and save the target file. I cannot see why it is not working. Can anyone spot it? The code works up until the point where it is supposed to open and modify the file. Thank you in advance.
strProtectedFile = "C:\srvr\rie-bin\CLIPr\Nav.xls"
strProtectedFilePassword = "1234"
Set oProtectedFile = xlApp.Workbooks.Open(strProtectedFile, strProtectedFilePassword, False)
oProtectedFile.Worksheets("Sheet1").Visible = True
oBookToProcess.WorkSheets(1).Range("A2:A11").Copy oProtectedFile.WorkSheets("Sheet1").Range("N8:N17")
oProtectedFile.Worksheets("Sheet1").Visible = False
xlApp.DisplayAlerts = False
oProtectedFile.Close True
xlApp.DisplayAlerts = True
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Sorry...it did work. Thank you!!
I would still like to know what the syntax is about if you have a moment.
I would still like to know what the syntax is about if you have a moment.
Sure :)
The syntax is
expression.Open(FileName, UpdateLinks, ReadOnly, Format, Password, WriteResPassword, IgnoreReadOnlyRecommended, Origin, Delimiter, Editable, Notify, Converter, AddToMru, Local, CorruptLoad)
If you open Excel and see it's help file you will get the explanation for each parameter in it :)
Sid
The syntax is
expression.Open(FileName, UpdateLinks, ReadOnly, Format, Password, WriteResPassword, IgnoreReadOnlyRecommended,
If you open Excel and see it's help file you will get the explanation for each parameter in it :)
Sid
ASKER