I have this section of code to be able to paste a range in Excel as a image into Word headers and footers. It was working perfectly to paste in the header but my efforts to copy the code to paste the footer has failed. The end result is the footer range has pasted correctly but has also pasted the footer range into the header.
Any assistance to correct this would be fantastic. Appreciate any support.
Any assistance to correct this would be fantastic. Appreciate any support.
VBA Code:
'Change the view to header & footer
If WordApp.ActiveWindow.View.SplitSpecial <> wdPaneNone Then
WordApp.ActiveWindow.Panes(2).Close
End If
'Select the Header range and paste as image
WordApp.ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader
WordApp.Selection.PasteSpecial Link:=False, DataType:=wdPasteEnhancedMetafile, _
Placement:=wdInLine, DisplayAsIcon:=False
'Select the Footer range and paste as image
WordApp.ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageFooter
WordApp.Selection.PasteSpecial Link:=False, DataType:=wdPasteEnhancedMetafile, _
Placement:=wdInLine, DisplayAsIcon:=False
WordApp.ActiveWindow.View.Type = wdNormalView
WordApp.ActiveWindow.View.Type = wdPrintView