I have an Excel sheet with Microsoft Word OLE objects embedded.
My embedded Word documents have some fields that should been updated with specific cells.
I need to print the content of that embedded document, without visible document opening and "update document prompts".
My problem is in copying the content of the Word-embedded OLE object in an invisible Word document without update prompting.
I try this:
This code paint a box around the embedded word document in destination printable document.
Please help me copy content of embedded document or ..., and print an embedded document without updating prompt and visible window.
Sub PrintIt(P As String, w, h As Double)
Dim objWord As Object
Dim ObjDoc As Object
Application.ScreenUpdating = False
Set objWord = CreateObject("Word.Application")
objWord.Visible = False
ActiveSheet.OLEObjects(P).Copy
Set ObjDoc = objWord.Documents.Add
ObjDoc.PageSetup.PageWidth = objWord.CentimetersToPoints(w)
ObjDoc.PageSetup.PageHeight = objWord.CentimetersToPoints(h)
ObjDoc.Content.Paste
ObjDoc.PrintOut Background:=False
ObjDoc.PrintOut
objWord.Quit SaveChanges:=False
Application.ScreenUpdating = True
End Sub 'Print it
o form
? BTW did you see the link that I posted in the first comment – Siddharth Rout