Topic Thread

Expand all | Collapse all

Importing Excel Object to Word Document

  • 1.  Importing Excel Object to Word Document

    Posted 07-05-2017 23:43
    HI, I want to import MS Excel Object at the End of Word Document but there seems there is no BP defined object for this. Please let me know: 1) is there any VBO which can help me to import an Excel object to MS Word document? I tried to code and run but I am getting below exception: Internal: Could not execute code stage because the exception is thrown by code stage: Type mismatch. (Exception from HRESULT: 0x80020005 (DISP_E_TYPEMISMATCH)) Please help or guide me. How can I achieve this? Here is the Code I am trying : Dim d As Object = GetDocument(handle,document_name) Dim w As Object = d.Application Dim r As Object = d.Range Dim ConfirmConversions As Object = False Dim Link As Object = False Dim Attachment As Object = True d.Bookmarks.Add("Page_End",r) if d.Bookmarks.Exists("Page_End") 'Dim Direction As Object = w.Selection.Collapse 'w.Selection.InsertFile(attaching_file, "Page_End", True, True, False) w.Selection.InsertFile(attaching_file, r, ConfirmConversions, Link, Attachment) end if d = Nothing w = Nothing

  • 2.  RE: Importing Excel Object to Word Document

    Posted 07-02-2020 17:05
    Hi Sumeet,

    The big question is your excel file is in csv? or xlsx? If it is separated by different columns seperated by comma (so it's in fact a CSV) .

    Have you tried object Utility - File Management with the action Read All Text from File or Get CSV Text As Collection if it is CSV. You can install Excel VBO too,

    Regarding the word file: The question applies: What content you plan to copy to? Transfer the tables from the excel document to an word file, or just copy paste the text?
    if it is just copy the text from Excel and paste to Word, it should be relatively easy. You can install Word VBO,

    - Use the 'Select' action of MS Excel VBO to highlight all your data that needs to be copied
    - 'Copy' action
    - 'Create instance' of the Word document (this can also be done at the beginning of the process)
    - 'Open'
    - 'Show' (optional)
    - 'Paste from Clipboard' action of MS Word VBO

    In Joe

    In Joe Khor
    Sr. Product Consultant
    Blue Prism