cancel
Showing results for 
Search instead for 
Did you mean: 

Importing Excel Object to Word Document

SUMEETMANGLESH
Level 3
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
1 REPLY 1

InJoeKhor
Staff
Staff
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, https://digitalexchange.blueprism.com/dx/entry/3439/solution/ms-excel-blue-prism-utility

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, https://digitalexchange.blueprism.com/dx/entry/3439/solution/ms-word-blue-prism-utility

- 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

Thanks,
In Joe

------------------------------
In Joe Khor
Sr. Product Consultant
Blue Prism
------------------------------
In Joe Khor Sr. Product Consultant Blue Prism