Helene
05-29-2019, 06:33 AM
Hello,
I am using a code from Jakob Hildbrand to paste my Excel sheet into Word (Thank you very much, simple but very useful):
Option Explicit
Sub PasteToWord()
Dim AppWord As Word.Application
Set AppWord = CreateObject("Word.Application")
AppWord.Visible = True
Sheets("Convert").UsedRange.Copy
AppWord.Documents.Add
AppWord.Selection.Paste
Application.CutCopyMode = False
Set AppWord = Nothing
End Sub
As my Excel sheet is formatted in a DINA4 page and has margins of 1.5 cm
at the top/bottom/left and right, the pasted word sheet excludes the
Headers and Footers of the Excel.
Do you have any idea how I can
extend the code/range to include also the Header/Footer in the paste
process? Do I have to use somehting like "With...Sheet("Convert to
Word").LeftHeader = docWord.LeftHeader"? I've been trying it out all
day, but I can't find the right solution. Maybe you can give me a hint
on howI can solve this problem?
Best regards, Helene
I am using a code from Jakob Hildbrand to paste my Excel sheet into Word (Thank you very much, simple but very useful):
Option Explicit
Sub PasteToWord()
Dim AppWord As Word.Application
Set AppWord = CreateObject("Word.Application")
AppWord.Visible = True
Sheets("Convert").UsedRange.Copy
AppWord.Documents.Add
AppWord.Selection.Paste
Application.CutCopyMode = False
Set AppWord = Nothing
End Sub
As my Excel sheet is formatted in a DINA4 page and has margins of 1.5 cm
at the top/bottom/left and right, the pasted word sheet excludes the
Headers and Footers of the Excel.
Do you have any idea how I can
extend the code/range to include also the Header/Footer in the paste
process? Do I have to use somehting like "With...Sheet("Convert to
Word").LeftHeader = docWord.LeftHeader"? I've been trying it out all
day, but I can't find the right solution. Maybe you can give me a hint
on howI can solve this problem?
Best regards, Helene