S
Senad Isanovic
Need to find more info about how to check if the Textbox already exits. If
that is the case, I don't want to add a new one but replace or remove and
then add a new textbox. The problem is that this code is run several times
in the document which means that the document contain several textboxes
laying above each other and I need to avoid that. Many thanks! /Senad
Dim footer As HeaderFooter
Dim mytxtbox As Shape
Set mytxtbox = footer.Shapes.AddTextbox(msoTextOrientationUpward, 0, 0, 12,
70, myrange)
With mytxtbox
.RelativeHorizontalPosition = wdRelativeHorizontalPositionPage
.Left = InchesToPoints(0.25)
.RelativeVerticalPosition = wdRelativeVerticalPositionPage
.top = InchesToPoints(top)
.Line.Visible = msoFalse
.TextFrame.MarginLeft = 1
.TextFrame.MarginRight = 1
.TextFrame.MarginBottom = 1
.TextFrame.MarginTop = 1
.TextFrame.TextRange.Font.Name = "Arial"
.TextFrame.TextRange.Font.Size = 6
.TextFrame.TextRange.Text = sRef
End With
Set myrange = Nothing
Set mytxtbox = Nothing
that is the case, I don't want to add a new one but replace or remove and
then add a new textbox. The problem is that this code is run several times
in the document which means that the document contain several textboxes
laying above each other and I need to avoid that. Many thanks! /Senad
Dim footer As HeaderFooter
Dim mytxtbox As Shape
Set mytxtbox = footer.Shapes.AddTextbox(msoTextOrientationUpward, 0, 0, 12,
70, myrange)
With mytxtbox
.RelativeHorizontalPosition = wdRelativeHorizontalPositionPage
.Left = InchesToPoints(0.25)
.RelativeVerticalPosition = wdRelativeVerticalPositionPage
.top = InchesToPoints(top)
.Line.Visible = msoFalse
.TextFrame.MarginLeft = 1
.TextFrame.MarginRight = 1
.TextFrame.MarginBottom = 1
.TextFrame.MarginTop = 1
.TextFrame.TextRange.Font.Name = "Arial"
.TextFrame.TextRange.Font.Size = 6
.TextFrame.TextRange.Text = sRef
End With
Set myrange = Nothing
Set mytxtbox = Nothing