View Full Version : [SOLVED:] How to check type of first character in a line
zemelo
10-31-2013, 06:19 AM
I want to check whether the first charakter in the next line of a text is a number or a letter.
If it is a letter I want to insert a tab before it.
Can anybody give me an example of a suitable macro ?
Anton
gmaxey
10-31-2013, 07:50 AM
Sub ScratchMacro()
'A basic Word macro coded by Greg Maxey
Dim oRng As Word.Range
Set oRng = Selection.Bookmarks("\Line").Range
If Not IsNumeric(oRng.Characters.First) Then
oRng.InsertBefore vbTab
End If
End Sub
zemelo
11-01-2013, 02:54 AM
Sub ScratchMacro()
'A basic Word macro coded by Greg Maxey
Dim oRng As Word.Range
Set oRng = Selection.Bookmarks("\Line").Range
If Not IsNumeric(oRng.Characters.First) Then
oRng.InsertBefore vbTab
End If
End Sub
Thank you very much for your help.
It saved me a lot of time studying the secrets of VBA
Anton
zemelo
11-02-2013, 02:17 AM
Hallo Greg,
may I ask you for some assistance again ?
I have a Word document with 2 rows
I want to do the checking number/letter in each line of both rows.
My problem is :
How to loop through the first row until its end
Then step into the second row and loop to the end of this row.
I can determine the total number of line of the the document, but not the number of lines in each of the two rows
(to use it for looping)
Thank you
Powered by vBulletin® Version 4.2.5 Copyright © 2025 vBulletin Solutions Inc. All rights reserved.