L
LearningVBA
Is there a reason why the file gets saved into My Documents folder instead
of a specific location on D drive? I ran the line carefully and it looks
fine but it does not get saved in the expected folder. The ChDir appears to
be on strike!
Thank you for your help
Function saveFile(ByVal thisDir As String, ByVal thisFile As String)
Dim isFileExist As Boolean
Dim fullPath As String
fullPath = thisDir & thisFile
isFileExist = fileInExistence(thisDir, thisFile)
If isFileExist Then
Kill thisDir & thisFile
ChDir thisDir
ActiveWorkbook.SaveAs fileName:=thisFile,
FileFormat:=xlWorkbookNormal, Password:="", WriteResPassword:="",
ReadOnlyRecommended:=False, CreateBackup:=False
Else
ChDir thisDir
ActiveWorkbook.SaveAs fileName:=thisFile, FileFormat:=xlNormal,
Password:="", WriteResPassword:="", ReadOnlyRecommended:=False,
CreateBackup:=False
End If
End Function
of a specific location on D drive? I ran the line carefully and it looks
fine but it does not get saved in the expected folder. The ChDir appears to
be on strike!
Thank you for your help
Function saveFile(ByVal thisDir As String, ByVal thisFile As String)
Dim isFileExist As Boolean
Dim fullPath As String
fullPath = thisDir & thisFile
isFileExist = fileInExistence(thisDir, thisFile)
If isFileExist Then
Kill thisDir & thisFile
ChDir thisDir
ActiveWorkbook.SaveAs fileName:=thisFile,
FileFormat:=xlWorkbookNormal, Password:="", WriteResPassword:="",
ReadOnlyRecommended:=False, CreateBackup:=False
Else
ChDir thisDir
ActiveWorkbook.SaveAs fileName:=thisFile, FileFormat:=xlNormal,
Password:="", WriteResPassword:="", ReadOnlyRecommended:=False,
CreateBackup:=False
End If
End Function