Saving MHTML file as XLSX file
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
11-11-20 01:11 PM
Hello,
I'm downloading a file from SAP as an MHTML file in Excel. Once it opens, I need to save as an XLSX file type. How can I accomplish this in BP without losing the formatting of the opened file? I tried using the Excel VBO Save Workbook As, copying from source to another destination workbook, etc... Nothing is working. Would appreciate any guidance!
I'm downloading a file from SAP as an MHTML file in Excel. Once it opens, I need to save as an XLSX file type. How can I accomplish this in BP without losing the formatting of the opened file? I tried using the Excel VBO Save Workbook As, copying from source to another destination workbook, etc... Nothing is working. Would appreciate any guidance!
------------------------------
Chris Rhea
------------------------------
1 REPLY 1
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
12-11-20 10:45 PM
Excel VBO Save Workbook As is not what it says - just new filename. To change file type you need custom action that lets you set file type, which should be available in extended VBO I guess.
Either way, code would be something like this, with new input number fileformat (values here: https://docs.microsoft.com/en-us/office/vba/api/excel.xlfileformat, you want 51):
------------------------------
Andrey Kudinov
Project Manager
MobileTelesystems PJSC
Europe/Moscow
------------------------------
Either way, code would be something like this, with new input number fileformat (values here: https://docs.microsoft.com/en-us/office/vba/api/excel.xlfileformat, you want 51):
newworkbookname = ExecWithTimeout(Timeout, "Save Workbook As",
Function()
Dim wb as Object = GetWorkbook(handle,workbookname)
Dim excel as Object = wb.Application
excel.DisplayAlerts = False
wb.SaveAs(filename, fileformat, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, True)
excel.DisplayAlerts = True
Return wb.Name
End Function)
p.s. That "True" in the end is irrelevant for you, but it tells excel that csv(fileformat=6) for example to be saved using local language settings.
------------------------------
Andrey Kudinov
Project Manager
MobileTelesystems PJSC
Europe/Moscow
------------------------------
