embedded Word document

M

michael.haight

I'm stuck. I'd definitely appreciate any help someone could offer!

I have an embedded word document on a worksheet - it's embedded as an
icon, not as a link. In a second worksheet (within the same workbook)
I would like to have the user open the embedded document from a
button. But I'm stuck as to how to write the VBA code to open it....
 
C

Chip Pearson

Try something like

Sub OpenWordDoc()
Dim OLEObj As OLEObject
Set OLEObj = Worksheets("Sheet1").OLEObjects("TheWordDoc")
OLEObj.Verb xlVerbOpen
End Sub

Where Sheet1 is the sheet with the Word document and "TheWordDoc" is the
name assigned to the Icon. If you have only one OLEObject on Sheet1, you can
use

Set OLEObj = Worksheets("Sheet1").OLEObjects(1)


--
Cordially,
Chip Pearson
Microsoft MVP - Excel, 10 Years
Pearson Software Consulting
www.cpearson.com
(email on the web site)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top