Quantcast
Channel: Word for Developers forum
Viewing all articles
Browse latest Browse all 4350

Shape color

$
0
0

I have the following macro that draws a line in a document. With the document saved as a .doc and I run the macro the line is BLACK. We are starting to save our documents as .docx files. When we save a document as a .docx file and run the following macro the line is now BLUE. How do I revise my macro to default back to BLACK?

Sub AddRevisionBar()
On Error GoTo endthis
For Each aVar In ActiveDocument.Variables
    If aVar.Name = "idx" Then
        num = aVar.Index
        Exit For
    End If
Next aVar

If num = 0 Then
    ActiveDocument.Variables.Add Name:="idx", Value:=0
End If
    idx = ActiveDocument.Variables("idx").Value + 1
    i = Selection.Information(wdVerticalPositionRelativeToPage)
    j = InchesToPoints(InputBox("BAR LENGTH {In Inches}:"))
    ActiveDocument.Shapes.AddLine(562, i, 562, j + i).Name = "vline" & idx
    ActiveDocument.Variables("idx").Value = idx
endthis:
Set aVar = Nothing
End Sub


Viewing all articles
Browse latest Browse all 4350

Trending Articles