Excel VBA extract text from shapes and paste results into a Word doc - revisited

biker9
biker9 used Ask the Experts™
on
This code had been written for me some time ago, it worked great while needed but abandoned after there was no longer need for it.

I now have Excel 2016 and Word 2016 installed, and the Microsoft Office 16.0 Object library is referenced. (I think when originally installed, it was on Excel 2013).

 I tried reinstalling the code on a new pc,  Excel opens the appropriate Word doc ie: “Model 2.docx” and then displays Error #5941, the  “the requested member of the collection does not exist” when attempting to run it. Sometimes, its simply a VB message box with a Red X with no message.

I would appreciate any suggestions,

Thanks,
Biker 9
Q-28250966.xlsm
Model-2.docx
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Excel & VBA Expert
Most Valuable Expert 2018
Awarded 2015
Commented:
That's because your Word Document doesn't have any Bookmark called "Paste_Here" which is being referenced in the code. Insert a Bookmark called "Paste_Here" in the document and your code should work fine.

Author

Commented:
Hello Subodh,

I tried your suggestion, inserted a bookmark (I know nothing about Word) and it is not working for me, empty message box appears, any other suggestions?
tx,
Ray

Author

Commented:
Actually, I'll take that back, I hadn't saved the file with the bookmark. Now it seems like it writes to the file (you see it only for an instant), and then immediately closes it.
Starting with Angular 5

Learn the essential features and functions of the popular JavaScript framework for building mobile, desktop and web applications.

Author

Commented:
Ok, I think I've disabled the save and exit, I will play with this some more and get back to you tomorrow. It looks promising, thanks for the help so far.
Ray
Subodh Tiwari (Neeraj)Excel & VBA Expert
Most Valuable Expert 2018
Awarded 2015

Commented:
You're welcome!

In your code Sub Q_28250966(ByRef strArray() As String), objDocument.Close True will save and close the document.

Author

Commented:
Thanks Subodh, that did it! I appreciate you having gotten back to me so quickly.
Ray
Subodh Tiwari (Neeraj)Excel & VBA Expert
Most Valuable Expert 2018
Awarded 2015

Commented:
You're welcome Ray! Glad it worked as desired.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial