D
dave.cuthill
I have embedded a word document in a excel sheet and now want to
figure out how to print the word document using VBA. I found the
following in one of the groups and it seems to error out at Set wDoc =
wObject.Object
"Type mismatch"
I think that I have all the references set correctly.
I would appreciated any help you might be able to provide.
Sub OpenPrintCloseWordDoc()
Dim wksDocs As Worksheet
Dim wObject As OLEObject
Dim wDoc As Word.Document
Set wksDocs = ThisWorkbook.Worksheets("Well Summary")
For Each wObject In wksDocs.OLEObjects
wObject.Activate
Set wDoc = wObject.Object
wDoc.PrintOut
wDoc.Close
Next wObject
End Sub
figure out how to print the word document using VBA. I found the
following in one of the groups and it seems to error out at Set wDoc =
wObject.Object
"Type mismatch"
I think that I have all the references set correctly.
I would appreciated any help you might be able to provide.
Sub OpenPrintCloseWordDoc()
Dim wksDocs As Worksheet
Dim wObject As OLEObject
Dim wDoc As Word.Document
Set wksDocs = ThisWorkbook.Worksheets("Well Summary")
For Each wObject In wksDocs.OLEObjects
wObject.Activate
Set wDoc = wObject.Object
wDoc.PrintOut
wDoc.Close
Next wObject
End Sub