Getting File Not Found

DannyDont

New Member
Joined
Mar 7, 2014
Messages
42
I have been pulling my hair out for a couple of days and there is no hair left so I thought I might ask a question.

In what I will call the "Automated" mode, I have a routine that opens a text file.
It then reads fully qualified CSV Filenames from the data in the text file.
I then use this filenames to open the file and to process the information contain within the CSV File
When attempting the File Open, I receive a File Not Found Error.

I can take the fully qualified filename and paste it into File Manger and it opens the File.
I can run through the program in what I will call "Normal" mode that allows me to select the filename from the open file dialog box..
The same filename that received the File Not Found in the Automated mode opens without issue.

I use the same code in both cases.
This is not a different "identical" set of Macros but the very same ones in both cases.
The only difference is that in the Automated Mode I get the filename from within another file while in the Normal Mode, I pick the filename from the VBA OperFile dialog box.
I do use dofferent File Nuimbers for the appropriate file opens.
I use file #3 when opening and reading the text file and File #1 to open and read the actual CSV File.

I have a similar routine running in different applications and it works just file.
I have tried to use that code but it is written so differently that it seems hard to do.

WARNING: I am an old coot and learned VBA the hard way.
My code "sucks" but I am trying to learn to use objects but I have a ways to go.
I was never exposed to OO coding until I sent my staff to training to learn how to use it.
I am rather clueless much to my chagrin.

I have no idea at this point what to try next.

You would probably like to see my code but I am not sure how I need to add this to my message within the forum.
Help there would be nice as well.

I hoee I have provided helpful information but will respond with any additional information requested.

Thank you for any light you might shed upon my issue.
Then perhaps my hair will grow back!

Dan Foltz
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
Hi Dan. Just copy the relevant bit of code and paste to the thread. Usually you would then select/highlight the posted code and then select the VBA icon at the top of the post reply box to post it as code but for some reason, it doesn't seem available right now? Anyways, just post the code and perhaps a moderator will fix the post. I'm guessing there's some invisible characters in your file name in the text file that's messing with your automation. HTH. Dave
 
Upvote 0
I determined what the issue was.
I attempted to save making duplicate files for the CSV files that I use in testing various versions of the applications.
To do that I made shortcuts to the files in another directory.
I have removed the shortcuts and copied the files over to the proper directory and all is well.
This came to me while watching the Detraiot Lions beat up on the Minnisota Vikings.

Problem is resolved
 
Upvote 0

Forum statistics

Threads
1,225,218
Messages
6,183,649
Members
453,177
Latest member
GregL65

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top