debkev1010
12-10-2014, 10:41 AM
I have a script that inserts OLEs into a Word document. The OLEs are in separate files (one OLE per file). The comment I most often get during the peer review process is "can you make your tables searchable?". The tables they're referring to are the objects that have been inserted by the script.
Here's the line that inserts the objects:
doc.ActiveWindow.Selection.InsertFile Filename:=path, Range:= "", ConfirmConversions:=False, Link:=False, Attachment:=False
What I end up doing to fix this is all manual. Say the OLE is an image of a Word table. After I run the script, I'll double click on the image/OLE object in the document 1. This opens document 2 with the image converted to its original table. I select all of the table and copy-n-paste it back into the document (replacing the OLE object). I tried to record a macro to see how my keystrokes/mouse clicks would be coded, but you can't open an object when you're in 'Record Macro' mode. Here are the steps I'm trying to write:
Existing code
1. after the script inserts the OLE into document 1, it selects the object using the Selection method
Missing code
2. perform the equivalent of double-clicking the object (this opens a new word document with the image converted to a table)
3. replacing the OLE object in document 1 with the converted table in document 2
Thanks,
Kevin
Here's the line that inserts the objects:
doc.ActiveWindow.Selection.InsertFile Filename:=path, Range:= "", ConfirmConversions:=False, Link:=False, Attachment:=False
What I end up doing to fix this is all manual. Say the OLE is an image of a Word table. After I run the script, I'll double click on the image/OLE object in the document 1. This opens document 2 with the image converted to its original table. I select all of the table and copy-n-paste it back into the document (replacing the OLE object). I tried to record a macro to see how my keystrokes/mouse clicks would be coded, but you can't open an object when you're in 'Record Macro' mode. Here are the steps I'm trying to write:
Existing code
1. after the script inserts the OLE into document 1, it selects the object using the Selection method
Missing code
2. perform the equivalent of double-clicking the object (this opens a new word document with the image converted to a table)
3. replacing the OLE object in document 1 with the converted table in document 2
Thanks,
Kevin