T
Tiffany
I am using vba code to save some tables into files.
I have hardcoded the filename that the file will be saved as in case they
type the wrong name. This is what I have used:
strFilter = ahtAddFilterItem(strFilter, "Excel Files (*.xls)", _
"*.xls")
strSaveFileName = ahtCommonFileOpenSave(OpenFile:=False, _
Filter:=strFilter, _
Flags:=ahtOFN_OVERWRITEPROMPT Or ahtOFN_READONLY)
If (strSaveFileName <> "") Then
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, "CW-Proj_Type",
"Central Western", True, "CW-Proj_Type"
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, "CW-Heavy",
"Central Western", True, "CW-Heavy"
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9,
"CW-Passenger", "Central Western", True, "CW-Passenger"
MsgBox "File has been saved.", vbInformation
Else
MsgBox "File has not been saved.", vbCritical
End If
I have used the hardcoding of the filename "Central Western", so even if the
user types in cw, it still saves it as Central Western and no mistakes are
made.
But what I am confused about is that when the file is saved, it saves it
with capital .XLS. I have searched everywhere in the functions it is using
and cannot find anything that is in capitals. It worked out before when I
left it as strSaveFileName, the user typed the filename and it saved ok, with
lower case .xls.
I have hardcoded the filename that the file will be saved as in case they
type the wrong name. This is what I have used:
strFilter = ahtAddFilterItem(strFilter, "Excel Files (*.xls)", _
"*.xls")
strSaveFileName = ahtCommonFileOpenSave(OpenFile:=False, _
Filter:=strFilter, _
Flags:=ahtOFN_OVERWRITEPROMPT Or ahtOFN_READONLY)
If (strSaveFileName <> "") Then
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, "CW-Proj_Type",
"Central Western", True, "CW-Proj_Type"
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, "CW-Heavy",
"Central Western", True, "CW-Heavy"
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9,
"CW-Passenger", "Central Western", True, "CW-Passenger"
MsgBox "File has been saved.", vbInformation
Else
MsgBox "File has not been saved.", vbCritical
End If
I have used the hardcoding of the filename "Central Western", so even if the
user types in cw, it still saves it as Central Western and no mistakes are
made.
But what I am confused about is that when the file is saved, it saves it
with capital .XLS. I have searched everywhere in the functions it is using
and cannot find anything that is in capitals. It worked out before when I
left it as strSaveFileName, the user typed the filename and it saved ok, with
lower case .xls.