-
Sub Selecionarperguntas()
Selection.MoveRight Unit:=wdWord, Count:=1
Application.ScreenUpdating = False
palavras = 0
Do Until Selection.Paragraphs(1).Style.NameLocal = "Título 1"
'Do Until ActiveDocument.Paragraphs(1).Style = "Título 1"
'If Linha() >= ActiveDocument.Paragraphs.Count Then GoTo fim
Selection.MoveDown Unit:=wdParagraph, Count:=1, Extend:=wdMove
Loop
palavras = 0
Do Until Selection.Words(1).Style.NameLocal <> "Título 1"
palavras = palavras + 1
Selection.MoveRight Unit:=wdWord, Count:=1
'If Linha() >= ActiveDocument.Paragraphs.Count Then GoTo fim
Loop
Selection.MoveLeft Unit:=wdWord, Count:=palavras, Extend:=wdExtend
If Linha() >= ActiveDocument.Paragraphs.Count Then GoTo fim
Application.ScreenUpdating = True
Selection.Copy
fim:
Application.ScreenUpdating = True
End Sub
Sub Selecionarresposta()
Application.ScreenUpdating = False
palavras = 0
Do Until Selection.Words(1).Style.NameLocal <> "Título 1"
Selection.MoveRight Unit:=wdWord, Count:=1
'If Linha() >= ActiveDocument.Paragraphs.Count Then GoTo fim
Loop
Do Until Selection.Words(1).Style.NameLocal = "Título 1"
Selection.MoveRight Unit:=wdWord, Count:=1
'If Linha() >= ActiveDocument.Paragraphs.Count Then GoTo fim
palavras = palavras + 1
Loop
fim:
Selection.MoveLeft Unit:=wdWord, Count:=palavras, Extend:=wdExtend
Selection.Copy
Application.ScreenUpdating = True
End Sub
I did this macro, but sometimes it is too slow, anyway to improve?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules