I am currently working on a temporary solution but run into a problem....
The situation is:
I have a converter built in Excel, that opens up a XLS File, does some tinkering so the file can be uploaded to an Oracle Database.
The problem is, the XLS file I opened I cannot get the Saveas Dialog box to that file, it always saves a copy of the converter instead.
What I need to happen is to open the Saveas Dialog box in a filepath set the file filter for CSV, for the file that i have opened.
RRBOOK.Activate The RR Book is the DIM'd file i opened
Dim FileName As String
FileName = Application.GetSaveAsFilename("\\FILEPATH\", FileFilter:="CSV (Comma delimited) (*.csv), *.csv")
If FileName <> "False" Then
ActiveWorkbook.SaveAs FileName
End If
Any help would be appreciated!
Avoid using ActiveWorkbook
and .Activate
.
Instead directly save the desired workbook by
RRBOOK.SaveAs FileName
Also you should specify the file format you wish to save in according to XlFileFormat enumeration and Workbook.SaveAs method .
So for saving as CSV you should eg use
RRBOOK.SaveAs FileName, xlCSV
So you would end up with something like
Dim FileName As Variant
FileName = Application.GetSaveAsFilename("\\FILEPATH\", FileFilter:="CSV (Comma delimited) (*.csv), *.csv")
If VarType(FileName) = vbBoolean And FileName = False Then
'user pressed cancel
Exit Sub
Else
RRBOOK.SaveAs FileName
End If
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.