Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/excel/26.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用excel VBA将图像添加到标题中_Excel_Vba - Fatal编程技术网

使用excel VBA将图像添加到标题中

使用excel VBA将图像添加到标题中,excel,vba,Excel,Vba,我正在尝试使用生成打印结果的VBA脚本将图像适配到excel工作表的标题中。(适合页码、页码等) 我已经有了一个工作脚本来生成想要的结果(没有图像的所有文本)。但当我尝试将链接图像添加到VBA代码中时,它似乎失败了 编辑:我删除了所有的信息,只剩下我在标题中添加图像的部分。 宏似乎可以工作,但当我查看结果时,预期的图像没有包含在文件中 Sub PlotPDF2() ActiveSheet.Outline.ShowLevels RowLevels:=0, ColumnLevels:=1 Act

我正在尝试使用生成打印结果的VBA脚本将图像适配到excel工作表的标题中。(适合页码、页码等)

我已经有了一个工作脚本来生成想要的结果(没有图像的所有文本)。但当我尝试将链接图像添加到VBA代码中时,它似乎失败了

编辑:我删除了所有的信息,只剩下我在标题中添加图像的部分。 宏似乎可以工作,但当我查看结果时,预期的图像没有包含在文件中

Sub PlotPDF2()


ActiveSheet.Outline.ShowLevels RowLevels:=0, ColumnLevels:=1
ActiveSheet.Outline.ShowLevels RowLevels:=2


Application.PrintCommunication = True
Application.Dialogs(xlDialogPrinterSetup).Show
With ActiveSheet.PageSetup
    ActiveWindow.View = xlPageBreakPreview
ActiveSheet.PageSetup.PrintArea = "$A:$O"
    .PrintTitleRows = "$1:$1"
    .PrintTitleColumns = ""
End With

Application.PrintCommunication = True
ActiveSheet.PageSetup.PrintArea = ""
Application.PrintCommunication = True
With ActiveSheet.PageSetup
    ActiveSheet.PageSetup.LeftHeaderPicture.Filename = _
    "\\SERVER\image1.jpg"
End With
With ActiveSheet.PageSetup.LeftHeaderPicture
    .Height = 1.2
    .Width = 17
End With

Application.PrintCommunication = True
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True, _
    IgnorePrintAreas:=False
End Sub

您能更具体地说明哪一行抛出错误吗?另外,仅供参考:VBA不是脚本语言。有一个
VB脚本
,这是一种脚本语言我已经调整了我的问题