Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() I am trying to generate reports and save the files in a folder, but I want to create the folder if it does not already exist. If it does exist, I want it to just save the file there. Right now I am just setting it to make a directory, which was fine, but if I have other reports going to that same folder and the folder already exists, I get a "Path/File Access error" Is there a little line of code I can put in that first checks to see if the folder exists? Thanks, ~J MyDate = Trim(VBA.Format(Now(), "MM-DD-YY")) Application.DisplayAlerts = False MkDir "G:\Reports\Friday Reports\" & MyDate ActiveWorkbook.SaveAs filename:="G:\Reports\Friday Reports\" & _ MyDate & "\" & filename -- nbaj2k ------------------------------------------------------------------------ nbaj2k's Profile: http://www.excelforum.com/member.php...o&userid=36480 View this thread: http://www.excelforum.com/showthread...hreadid=570801 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Need code to save file to new folder, erase from old folder | Excel Discussion (Misc queries) | |||
open file from folder save in new folder | Excel Programming | |||
"Save As" folder -- can I default this to the same folder as origi | Excel Discussion (Misc queries) | |||
Create Folder If It Doesn't Exist | Excel Programming | |||
Create Folder and Text File in folder | Excel Programming |