Open Files

M

MWK

I'm trying to grab filenames (path & name) from a table. When I add the
cell text to the variable and use it in my code, I get a "cannot find file"
error. If I take the cell information as written and use it like this, it
works:

set mydoc = Documents.Open (filename:="filename"), it will work. If I use a
variable (filename:=sMyFile) it will not work.

Any help would be appreciated.

Thanks
 
S

Steve Lang

Hi "MWK"
Test the value if the sMyFile before opening it. I'm guessing that there is
a control character at the end of the string that is making the filename
invalid. This would especially be true if you are using cell.range.text as a
way to get the text out of the table.

HTH and have a great day!

Steve
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top