Macro issue - Excel 2013

Author
Discussion

Jonboy_t

Original Poster:

5,038 posts

183 months

Friday 22nd September 2017
quotequote all
Am just putting one together to try and cut out some time on a repetitive job that me and my colleagues do. It essentially reformats and saves a bunch of reports that come out of an Access DB that a previous colleague wrote.

I've done the below with the intention of it using a filepath and filename that I've already created earlier in the process. Everything up to now works tickety-boo, but I just can't get it to save to the certain filepath - it goes into a temp folder somewhere (but is named correctly according to the code below). For example, if I wanted it to save "blah.xlsx" in C:\john\Blah Folder, it is currently saving "blah.xlsx" but in a random folder (presumably, a default location?).

I'm 99.9% certain I've missed something basic here, but I'm doing it all with little experience at this level, so am on the fly a bit!



For info - cell M6 is what I want the name to be and cell G3 is the folder name. The folder is already created at this point by one of the first commands in the macro.

Any tips for where I might be screwing it up?

nyt

1,807 posts

150 months

Friday 22nd September 2017
quotequote all
You're not combining the file path & file name before passing it to 'saveas'

fullfilenamepath = fPath & "\" & fName

... SaveAs Filename = fulfilenamepath

Jonboy_t

Original Poster:

5,038 posts

183 months

Friday 22nd September 2017
quotequote all
nyt said:
You're not combining the file path & file name before passing it to 'saveas'

fullfilenamepath = fPath & "\" & fName

... SaveAs Filename = fulfilenamepath
You are amazing, thank you so much!!!