Sub TempFolder()
Dim oFSObj As Object
Dim strTempFolder As String
Set oFSObj = CreateObject("Scripting.FileSystemObject")
strTempFolder = oFSObj.GetSpecialFolder(2).Path
MsgBox strTempFolder
End Sub
ThisDirectory = CurDir
ChDir NewDirectory
[do stuff here]
ChDir ThisDirectory
Sub saveto()
Dim fullname, pth, rsp
pth = InputBox("Enter the Folder to save file in" & Application.Rept(vbLf, 1) _
& "i.e. C:\mydocuments" & Application.Rept(vbLf, 1) _
& "or D:", "FOLDER NAME")
If pth = vbNullString Then
rsp = MsgBox("File will be saved to " & Application.DefaultFilePath, vbYesNo)
If rsp <> vbYes Then
Exit Sub
End If
End If
fullname = pth & "\" & Thisworkbook.Name
ThisWorkbook.SaveAs fullname, , , , , , , , True ' adds to MRU list
MsgBox "File saved as:" & Chr(10) & Chr(10) & fullname, vbExclamation, "STATUS"
End Sub
selkov said:I am getting a sytanx error & my help file does not work. Can you correct this?
ThisDirectory = CurDir
ChDir c:\zzzz\2004 ' error here!!
[do stuff here]
ChDir ThisDirectory
Thanks
ChDir "c:\zzzz\2004"