Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Need Script to Open and Save .xlsx

Need Script to Open and Save .xlsx

Need Script to Open and Save .xlsx


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"

RE: Need Script to Open and Save .xlsx


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

That's a problem that no code will solve.


glassesJust traded in my OLD subtlety...
for a NUance!tongue

RE: Need Script to Open and Save .xlsx

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

RE: Need Script to Open and Save .xlsx

Got it working.

Is it possible to put the PREVIOUS days date on the end of a file and not the current?

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close