Greetings,
If I FIRST open Excel, and then click OPEN and navigate to the folder where my Excel file, is, and open it that way, and then click a button to run some VBA code, the code runs fine... no problems at all.
HOWEVER, I've discovered if I use Windows Explorer to navigate to the folder where my Excel file is, and then double-click on it to open it up that way, the program crashes when I click the same button and run the very same VBA code.
When the program crashes it crashes because it can't find a file it's trying to open.
The filename it's trying to open is listed in my program as "folder 1\folder.xlsx". Notice there is no letter drive in the filename. (Furthermore, that's not even the full path. I'm actually nested a bit further deeper, on my E: drive.) That's just the path starting where my excel vba program is located.
But there's noting wrong with that as my filename, because, as I mentioned above, opening that filename DOES work when I open Excel first and use Excel to open my vba program.
Now, I already have this coded, prior to opening the file:
ChDir ThisWorkbook.Path
This should, and it looks like it does, change the computer's path to the folder I'm in. This is why I can successfully open "folder 1\folder.xlsx"
So shouldn't that statement take care of my problem?
Why in blazes does my program work when I open Excel first, and use Excel to open the program, and not when I just open my Excel vba program just by double-clicking it via Windows Explorer?
As always, thanks in advance for any replies.
Bookmarks