Home > Software engineering >  How to put the text frame's increasing number automatically? Some font change big red? Written
How to put the text frame's increasing number automatically? Some font change big red? Written

Time:09-16

Such as: how to put the text frame's increasing number automatically? Some font change big red? Written in VBA code execution or

The code is as follows: how to modify the code?

CodePudding user response:

Without your documents, don't know how to adjust the font, can only help you here.
 Option Explicit 

Sub automatic numbering ()
Application. ScreenUpdating=False
Dim shpTemp As Shape, intStart As Long
IntStart=InputBox (" please enter the number of initial count, the default is "1000000001" : ", "input value", "1000000001")
For Each shpTemp In ThisDocument. Shapes
ShpTemp. TextFrame. TextRange. Paragraphs (2). The Range="stub: NO" & amp; IntStart
IntStart=intStart + 1
Next
Application. ScreenUpdating=True
End Sub

CodePudding user response:

Change, increase the Font color and Size, you can manually modify the Font Size, Font, Size) :
 Option Explicit 

Sub automatic numbering ()
Application. ScreenUpdating=False
Dim shpTemp As Shape, intStart As Long
IntStart=InputBox (" please enter the number of initial count, the default is "1000000001" : ", "input value", "1000000001")
For Each shpTemp In ThisDocument. Shapes
With shpTemp. TextFrame. TextRange. Paragraphs (2). The Range
. The Text="stub: NO" & amp; IntStart
The Bold=True
, the Font Color=wdColorRed
, the Font Size=15
End With
IntStart=intStart + 1
Next
Application. ScreenUpdating=True
End Sub

CodePudding user response:

refer to the second floor milaoshu1020 response:
change, increase the Font color and Size, you can manually modify the Font Size, Font, Size) :
 Option Explicit 

Sub automatic numbering ()
Application. ScreenUpdating=False
Dim shpTemp As Shape, intStart As Long
IntStart=InputBox (" please enter the number of initial count, the default is "1000000001" : ", "input value", "1000000001")
For Each shpTemp In ThisDocument. Shapes
With shpTemp. TextFrame. TextRange. Paragraphs (2). The Range
. The Text="stub: NO" & amp; IntStart
The Bold=True
, the Font Color=wdColorRed
, the Font Size=15
End With
IntStart=intStart + 1
Next
Application. ScreenUpdating=True
End Sub

First of all, thank you very much for your answer, I can't upload documents, I is according to the code you write in execution, the results are not ideal:
1. The word no alignment, downward no automatic carriage returns,
2. The code in the text box is wrong, my request is that peer text box number is the same, increasing a text box to the next line + 1
3.. After executing code display only four lines of text box code automatically incrementing, this page 9 of text boxes, mean there is no automatic coding, behind the
I want the result is as follows:

CodePudding user response:

Quote: refer to the second floor milaoshu1020 response:

Change, increase the Font color and Size, you can manually modify the Font Size, Font, Size) :
 Option Explicit 

Sub automatic numbering ()
Application. ScreenUpdating=False
Dim shpTemp As Shape, intStart As Long
IntStart=InputBox (" please enter the number of initial count, the default is "1000000001" : ", "input value", "1000000001")
For Each shpTemp In ThisDocument. Shapes
With shpTemp. TextFrame. TextRange. Paragraphs (2). The Range
. The Text="stub: NO" & amp; IntStart
The Bold=True
, the Font Color=wdColorRed
, the Font Size=15
End With
IntStart=intStart + 1
Next
Application. ScreenUpdating=True
End Sub

[/quot/]
My word document text box is inserted into the two text boxes in a line, means: there are 9 lines in the word document, 18 text boxes, and other nine small text box, namely "stamp"

Excuse me, teacher, can I add you QQ email originating file? My email is 369185132 @qq.com

CodePudding user response:

My email is: [email protected].

This is once every two (a line), increased the carriage returns code:
 
Option Explicit

Sub automatic numbering ()
Application. ScreenUpdating=False
Dim shpTemp As Shape, intStart As Long
IntStart=InputBox (" please enter the number of initial count, the default is "1000000001" : ", "input value", "1000000001")
Dim As Integer I
I=0

For Each shpTemp In ThisDocument. Shapes
With shpTemp. TextFrame. TextRange. Paragraphs (2). The Range
. The Text="stub: NO" & amp; IntStart & amp; VbCrLf
The Bold=True
, the Font Color=wdColorRed
, the Font Size=15
End With
I=I + 1
If I Mod 2=0 Then
IntStart=intStart + 1
End the If
Next
Application. ScreenUpdating=True
End Sub

As for the back not, can only say that the back and the front is not the same, there is no corresponding Range.
  •  Tags:  
  • VBA
  • Related