Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need Script to Open and Save .xlsx

Status
Not open for further replies.

jtopp

IS-IT--Management
Jan 6, 2016
3
US
Hi,

I got on here to try and find a script that will open an Excel 2013 file and save it to a different folder. (Side Note: I am hoping that it will have enough time to let all my data connections refresh)

When I use the script below it says, "This file is locked for editing by another user. Do you want to: (1)View a read only copy? (2) Save and edit a copy of the file?

Here is the script I used:


set objExcel = createObject("Excel.Application")
objExcel.visible = True
set objWb = objExcel.Workbooks.Open("C:\Users\jtopper\OneDrive for Business 1\Daily-Weekly Reports\Daily\Hilliard Daily Report.xlsx")
msgbox "make sure data is ok" 'Here I can see all data was read properly, now I need to save it
objWb.saveas "C:\Users\jtopper\Dropbox\Hilliard\Reports\1 Hilliard Report\Daily\Hilliard Daily Report.xlsx %date:/=-%.csv"
 
Hi,

"This file is locked for editing by another user."

That's a problem that no code will solve.

Skip,
[sub]
[glasses]Just traded in my OLD subtlety...
for a NUance![tongue][/sub]
 
there are probably additional parameters you can supply to the saveas method which allow to automatically choose the options which you are being prompted for

I Hear, I Forget
I See, I Remember
I Do, I Understand

Ronald McDonald
 
Got it working.

Is it possible to put the PREVIOUS days date on the end of a file and not the current?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top