ส่วนท้ายแบบไดนามิกของ MS Word VBA

ฉันต้องการแทนที่ป้ายกำกับในส่วนท้าย ใช้งานได้ แต่การแทนที่จะลบเส้นแนวนอนเหนือข้อความส่วนท้าย ฉันจะเปลี่ยนฉลากโดยไม่ลบเส้นแนวนอนได้อย่างไร ฉันจะวาดเส้นในส่วนท้ายได้อย่างไร?

Private Sub Document_Open()
   Dim unit As String
   Dim footer As String
   unit = "New text"
   footer = ActiveDocument.Sections(1).Footers(wdHeaderFooterFirstPage).Range.Text
   ActiveDocument.Sections(1).Footers(wdHeaderFooterFirstPage).Range.InlineShapes.AddHorizontalLineStandard   
   footer = Replace(footer, "<<Label>>", unit)
   ActiveDocument.Sections(1).Footers(wdHeaderFooterFirstPage).Range.Text = footer
End Sub

person sada    schedule 15.08.2012    source แหล่งที่มา


คำตอบ (1)


มีหลายวิธีในการทำสิ่งที่คุณต้องการ ไม่ใช่ทั้งหมดใน VBA คุณได้ลองอะไรไปแล้ว?

ถ้าคุณต้องการใช้ VBA เพื่อวาดเส้นเหนือข้อความ ให้ตั้งค่าเคอร์เซอร์ในตำแหน่งที่คุณต้องการ แล้วเรียกสิ่งต่อไปนี้:

With Selection.Borders(wdBorderTop)
    .LineStyle = Options.DefaultBorderLineStyle
    .LineWidth = Options.DefaultBorderLineWidth
    .Color = Options.DefaultBorderColor
End With
person Olle Sjögren    schedule 15.08.2012