Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 11-03-2011, 05:22 AM
tinfanide tinfanide is offline saveAs ChDir _ Windows 7 64bit saveAs ChDir _ Office 2010 32bit
Expert
saveAs ChDir _
 
Join Date: Aug 2011
Posts: 312
tinfanide is on a distinguished road
Default saveAs ChDir _

Code:
Sub saveFile()

Dim newFile As String, fName As String
fName = "test"
newFile = fName & " " & Format$(Date, "yyyy-mm-dd")
ChDir _
"C:\Users\Tin\Desktop\"
ActiveWorkbook.SaveAs Filename:=newFile


End Sub
But if I don't use ChDir _
It is fine.
If I use ChDir _


even the location path is correct
the file will be saved in my Document Folder
Why?

Code:
Sub saveFile()

Dim newFile As String, fName As String
fName = "test"
newFile = fName & " " & Format$(Date, "yyyy-mm-dd")

ActiveWorkbook.SaveAs "C:\Users\Tin\Desktop\" & newFile

End Sub
Reply With Quote
 



Other Forums: Access Forums

All times are GMT -7. The time now is 01:24 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft