Getting Started

last person joined: 11 hours ago 

Get talking! If you're new to Blue Prism, use this community to help you get started.
Expand all | Collapse all

Saving MHTML file as XLSX file

  • 1.  Saving MHTML file as XLSX file

    Posted 11-11-2020 08:11
    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!


    ------------------------------
    Chris Rhea
    ------------------------------


  • 2.  RE: Saving MHTML file as XLSX file

    Posted 11-12-2020 17:45
    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):
    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
    ------------------------------



Share