Jump to content
Macro Express Forums

Unable to open file: unexpected "the file could not be located" error


Recommended Posts

In my macro I am trying to copy the contents of a cell from Excel (the location fo a file on disk), and then open the file. Sounds simple enough but this is my first ever macro, so I am doing something wrong and have no idea what.

 

Below are the lines from Script Editor:

> Text Type (Simulate Keystrokes): <DOWN ARROW>

> Clipboard Copy

> Variable Set String %filepath% from the clipboard contents

> Program Launch: "%filepath%" (Normal)

Parameters:

 

 

I get the error "The file could not be located "_filepath_" at the last line above. I know that the filepath is correct because if I adjust the macro to open the Run window (<Win>r), paste the clipboard contents and press <ENTER>, the file is loaded. The problem is that this workaround doesn't work everytime, so the macro fails from time to time.

 

How can I open the file directly from within the macro? please help.

 

-Patrick

Link to comment
Share on other sites

Excel will put EoL (End of Line) characters at the end of the text string. Use the Trim command on that variable after you copy it from Excel. This will remove all invisible characters.

 

If you have a list you might consider saving it to a text file and using the Text File Process command instead.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...