export chart to word (1 Viewer)

SantoR

Registered User.
Local time
Today, 08:35
Joined
Apr 20, 2015
Messages
38
i have a form which displays 2 charts, i am able to export them to word document but i donot know how to paste them one after the other. currently they get printed one over the other.

here is the code :

Code:
Private Sub cmd_Print_Click()

Dim MyChartObj As Object
Dim MyLineObj As Object


Set MyChartObj = [Forms]![MainForm]![Sub_DisplayFm]![Graph_Chart]
Set MyLineObj = [Forms]![MainForm]![Sub_DisplayFm]![Graph_Line]

MyChartObj.SetFocus
DoCmd.RunCommand acCmdCopy

    With CreateObject("Word.Application")
  
        .Documents.Add
        .Selection.PasteSpecial False, 0, 1, False '.Selection.PasteSpecial False, wdPasteOLEObject, wdFloatOverText, False
        
    End With
    

MyLineObj.SetFocus
DoCmd.RunCommand acCmdCopy

    With GetObject(, "Word.Application")
        .Visible = True
        .Selection.PasteSpecial False, 0, 1, False '.Selection.PasteSpecial False, wdPasteOLEObject, wdFloatOverText, False
        
    End With
 
MsgBox "done"

End Sub
 

vbaInet

AWF VIP
Local time
Today, 04:05
Joined
Jan 22, 2010
Messages
26,374
Your question will be best served in an appropriate Word VBA forum.

I would imagine that you just need to move a line down after the first pasted object, then paste the second object.
 

Users who are viewing this thread

Top Bottom