我试图将Word文档封面添加到从Excel打印的报价中。
这是我尝试过的方法,但是我可以看到在尝试使用数组中的对象时存在缺陷。
我想将以Word文档为封面的Excel工作表的当前选择打印到一个PDF文件中。
Sub PrintQuoteCover()
Set WordApp = Nothing 'release the memory
Dim objWord As Object
Dim objDoc As Object
Dim CSELECT As Range
Set CSELECT = Selection
Set objWord = CreateObject("Word.Application")
objWord.Visible = False
Set objDoc = objWord.Documents.Open("O:\12.Product Info\QUOTE COVER MARKETING.docx")
Dim ARRAYONE As Variant
ARRAYONE = Array(objDoc, CSELECT)
ARRAYONE.Select
Selection.ExportAsFixedFormat Type:=xlTypePDF, Filename:="O:\1.To Quote\" & _
FileName1, Quality:=xlQualityStandard, IncludeDocProperties:=True, _
IgnorePrintAreas:=False, OpenAfterPublish:=False
Set WordApp = Nothing 'release the memory
End Sub