我有一个包含几张纸的工作簿。在每张纸上,我都必须在页眉中放置一个图像。在第一页中,图像必须是其尺寸的90%并居中,在其他页面中,其图像必须位于其右侧的50%。
为客户“ CPG”或“ SUDECO”的每张纸遵循以下程序
不幸的是,右侧的图像仅为100%。看起来,尽管我逐步调试时发现图像已缩小,但在过程结束时,图像又恢复了原始大小。
Sub InsertHeaderPicture(pws As Worksheet, pclient As String, pLocation As Long)
If pLocation = xlCenter Then
With pws.PageSetup.CenterHeaderPicture
If pclient Like "CPG" Then
.Filename = "Z:\ADE\ADMINISTRATIFS ADE\LOGOS ET EN-TETES\CARREFOUR\original_Nvo_20logo_20CarrefourProperty_ver_RVBb.jpg"
.Height = 225
.Width = 417.75
ElseIf pclient Like "SUDECO" Then
.Filename = "Z:\ADE\ADMINISTRATIFS ADE\LOGOS ET EN-TETES\CASINO\Logos Casino\Logo_Sudeco.png"
.Height = 225
.Width = 417.75
End If
End With
pws.PageSetup.CenterHeader = "&G"
ElseIf pLocation = xlRight Then
With pws.PageSetup.RightHeaderPicture
If pclient Like "CPG" Then
.Filename = "Z:\ADE\ADMINISTRATIFS ADE\LOGOS ET EN-TETES\CARREFOUR\original_Nvo_20logo_20CarrefourProperty_ver_RVBb.jpg"
.Height = 90
.Width = 170
ElseIf pclient Like "SUDECO" Then
.Filename = "Z:\ADE\ADMINISTRATIFS ADE\LOGOS ET EN-TETES\CASINO\Logos Casino\Logo_Sudeco.png"
.Height = 90
.Width = 170
End If
End With
pws.PageSetup.RightHeader = "&G"
End If
End Sub