Hi All,
I am new to vb and i tried a macro in word to find the paragraph indents and insert some tag for that indented text for e.g. indent 0.5 to 0.75 to be coded as <indent1> and 0.76 to 1.00 as “<indent2>”
Accommodate, (66) p.22, p.24,p.55
Acid
<indent1>Diphos phonic Acid, (35)p.36
<indent2>Acryli c Acid, (35) p.36-37
And this is my code
[CODE=vb]Sub IndentTagging()
Indent = Val(0.5)
With Selection.Find. ParagraphFormat
Do While Indent <= InchesToPoints( 0.75)
.LeftIndent = InchesToPoints( Indent)
MsgBox ("this is left indent " & (.LeftIndent))
With Selection.Find
.Text = ""
.Replacement.Te xt = "<indent1>^ &"
.Forward = True
.Wrap = wdFindContinue
.Format = True
.MatchWildcards = False
End With
Selection.Find. Execute Replace:=wdRepl aceAll
Indent = Indent + 0.01
MsgBox ("this is variable " & InchesToPoints( Indent))
Loop
End With
End Sub[/CODE]
The problem is when I pass the variable value to Leftindent it rounded the value i.e., 44.44 converted as 44.45 please tell me how to avoid this
Thanks in Advance
Baskar
I am new to vb and i tried a macro in word to find the paragraph indents and insert some tag for that indented text for e.g. indent 0.5 to 0.75 to be coded as <indent1> and 0.76 to 1.00 as “<indent2>”
Accommodate, (66) p.22, p.24,p.55
Acid
<indent1>Diphos phonic Acid, (35)p.36
<indent2>Acryli c Acid, (35) p.36-37
And this is my code
[CODE=vb]Sub IndentTagging()
Indent = Val(0.5)
With Selection.Find. ParagraphFormat
Do While Indent <= InchesToPoints( 0.75)
.LeftIndent = InchesToPoints( Indent)
MsgBox ("this is left indent " & (.LeftIndent))
With Selection.Find
.Text = ""
.Replacement.Te xt = "<indent1>^ &"
.Forward = True
.Wrap = wdFindContinue
.Format = True
.MatchWildcards = False
End With
Selection.Find. Execute Replace:=wdRepl aceAll
Indent = Indent + 0.01
MsgBox ("this is variable " & InchesToPoints( Indent))
Loop
End With
End Sub[/CODE]
The problem is when I pass the variable value to Leftindent it rounded the value i.e., 44.44 converted as 44.45 please tell me how to avoid this
Thanks in Advance
Baskar
Comment