ฉันต้องแก้ไขคุณสมบัติของรูปภาพที่แทรกโดยวิธี AddPicture
1) ฉันต้องปรับความสูงเป็น 0.5" และความกว้างเป็นตัวแปร (ล็อคอัตราส่วนภาพ)
2) ตัดข้อความ = "อยู่ด้านหน้าข้อความ"
เป็นไปได้ด้วยวิธีนี้หรือไม่? ถ้าเป็นเช่นนั้น ฉันจะเพิ่มคุณสมบัติเหล่านั้นได้อย่างไร? ถ้าไม่ฉันควรใช้วิธีอื่นใดและอย่างไร?
Sub replaceWithImage()
Dim imageFullPath As String
Dim FindText As String
imageFullPath = "C:\Logo.jpg"
FindText = "PlaceHolder"
'Application.ScreenUpdating = False
With Selection
.HomeKey Unit:=wdStory
With .Find
.ClearFormatting
.text = FindText
' Loop until Word can no longer
' find the search string, inserting the specified image at each location
Do While .Execute
Selection.MoveRight
Selection.InlineShapes.AddPicture FileName:=imageFullPath, LinkToFile:=False, SaveWithDocument:=True
Loop
End With
End With
End Sub