R
Rob
hi,
here is a code snippet, small part of a large specific Word macro, which we
use for many, many years (>10 years), unfortunately this code runs very slow
under Word 2007...., you can test this with a random Word document...
does anybody have a solution for this? (I don't know if re-writing the
Wordbasic code to VBA will speed up the program in Word 2007, I don't know
the VBA equivalents of some Wordbasic commands...)
all suggestions are welcome!
Sub Testcase()
Dim starttime As String
Dim endtime As String
On Error GoTo ready
starttime = Time
ActiveDocument.Select
WordBasic.ScreenUpdating 0
WordBasic.EditCopy
WordBasic.CopyBookmark "\Sel", "test"
WordBasic.seltype 1
While WordBasic.CmpBookmarks("\Sel", "test") = 8 _
Or WordBasic.CmpBookmarks("\Sel", "test") = 6 _
Or WordBasic.CmpBookmarks("\Sel", "test") = 10 _
And leaveloop <> 1
WordBasic.EndOfLine
If WordBasic.CmpBookmarks("\Sel", "\EndOfDoc") = 0 Then leaveloop = 1
WordBasic.EndOfLine
WordBasic.Charright 1, 1
B = Asc(WordBasic.[GetBookmark$]("\char"))
If B <> 13 And B <> 12 And B <> 11 And B <> 14 Then
WordBasic.CharLeft
WordBasic.Underline 0
WordBasic.Bold 0
WordBasic.Insert Chr(11)
Else
WordBasic.EndOfLine
WordBasic.Charright 1, 1
WordBasic.Underline 0
WordBasic.Bold 0
WordBasic.CharLeft
WordBasic.LineDown
End If
DoEvents
Wend
ready:
endtime = Time
MsgBox "ready, starttime: " & starttime & " endtime: " & endtime
End Sub
Rob
here is a code snippet, small part of a large specific Word macro, which we
use for many, many years (>10 years), unfortunately this code runs very slow
under Word 2007...., you can test this with a random Word document...
does anybody have a solution for this? (I don't know if re-writing the
Wordbasic code to VBA will speed up the program in Word 2007, I don't know
the VBA equivalents of some Wordbasic commands...)
all suggestions are welcome!
Sub Testcase()
Dim starttime As String
Dim endtime As String
On Error GoTo ready
starttime = Time
ActiveDocument.Select
WordBasic.ScreenUpdating 0
WordBasic.EditCopy
WordBasic.CopyBookmark "\Sel", "test"
WordBasic.seltype 1
While WordBasic.CmpBookmarks("\Sel", "test") = 8 _
Or WordBasic.CmpBookmarks("\Sel", "test") = 6 _
Or WordBasic.CmpBookmarks("\Sel", "test") = 10 _
And leaveloop <> 1
WordBasic.EndOfLine
If WordBasic.CmpBookmarks("\Sel", "\EndOfDoc") = 0 Then leaveloop = 1
WordBasic.EndOfLine
WordBasic.Charright 1, 1
B = Asc(WordBasic.[GetBookmark$]("\char"))
If B <> 13 And B <> 12 And B <> 11 And B <> 14 Then
WordBasic.CharLeft
WordBasic.Underline 0
WordBasic.Bold 0
WordBasic.Insert Chr(11)
Else
WordBasic.EndOfLine
WordBasic.Charright 1, 1
WordBasic.Underline 0
WordBasic.Bold 0
WordBasic.CharLeft
WordBasic.LineDown
End If
DoEvents
Wend
ready:
endtime = Time
MsgBox "ready, starttime: " & starttime & " endtime: " & endtime
End Sub
Rob