0
我試圖在Excel中的打印區域的右側插入一個標誌。鑑於這是隻有TOP和左參考,我已經嘗試以下內容:VBA右對齊
Private Sub InsertLogo(Name As String)
Dim MyPic As Shape
Dim MyLeft As Single, MyTop As Single
FilePath = FolderPath + Name + ".png"
If Not Dir(FilePath) <> "" Then
MsgBox ("No logo exists for " & Name & " in Logos. Save the logo as .png file in the logo folder as " & Name & ".")
Exit Sub
End If
MyTop = MySht.[y7].Top
MyLeft = MySht.[y7].Left - MyPic.Width
Set MyPic = MySht.Shapes.AddPicture(FilePath, _
msoFalse, msoTrue, MyLeft, MyTop, -1, -1)
任何人有任何建議該怎麼辦?
非常感謝您@EEM。好像我遇到了各種圖片大小的問題。試圖插入在端部執行以下操作: MyPic.Height = 40 '' 調整如果寬度支配高度 如果MyPic.Width/MyPic.Height> 3。然後MyPic.Height = 25 如果MyPic.Width/MyPic.Height > 4然後MyPic.Height = 20 但我想圖片的縮放應該在插入之前完成? – Naits
看來您的原始問題已被回答。縮放圖片是一個新問題。 – EEM