Visual Basic UNC folder
I can't figure out how to get the new code to work. I want to have visual basic detect when a folder does not exist and create the folder. I also want the code to reference the UNC server since each user migh have different drives mapped to the shared directory.
Old code:
MkDir "L:\PSGLRPTS\" & BusinessUnit & "\" & YearDate & MonthDate
ActiveWorkbook.SaveAs FileName:="L:\PSGLRPTS\" & BusinessUnit & "\" & YearDate & MonthDate & "\Yr" & ProjYear & "Proj.XLS", _
New code:
MkDir "\\server\sharefolder\PSGLRPTS\" & BusinessUnit & "\" & YearDate & MonthDate
ActiveWorkbook.SaveAs FileName:=""\\server\sharefolder\PSGLRPTS\" & BusinessUnit & "\" & YearDate & MonthDate & "\Yr" & ProjYear & "Proj.XLS", _
[756 byte] By [
just22] at [2007-11-11 10:13:15]

# 1 Re: Visual Basic UNC folder
Did you try already to enclose the path with chr(34), like this?
MkDir chr(34) & "\\server\sharefolder\PSGLRPTS\" & BusinessUnit & "\" & YearDate & MonthDate & chr(34)
ActiveWorkbook.SaveAs FileName:=chr(34) & "\\server\sharefolder\PSGLRPTS\" & BusinessUnit & "\" & YearDate & MonthDate & "\Yr" & ProjYear & "Proj.XLS" & chr(34)