Come posso estrarre tutte le righe, di un documento di Word, che hanno al loro interno la parola "Vedi pag."
ed eventualmente salvarle in un altro documento o in un file di Excel
Grazie anticipatamente
Moderatori: Anthony47, Flash30005
Sub CercaAll()
Dim fString As String
Dim fCount As Long, dDoc As Document
'
fString = "Vedi Pag." '<<< La stringa da cercare
'
Documents.Add 'DocumentType:=wdNewBlankDocument
Set dDoc = ActiveDocument
ThisDocument.Activate
Application.ScreenUpdating = False
fCount = 0
With Selection
.HomeKey unit:=wdStory
With .Find
.ClearFormatting
.Text = fString
'Cerca:
Do While .Execute
DoEvents
fCount = fCount + 1
Selection.HomeKey unit:=wdLine
Selection.EndKey unit:=wdLine, Extend:=wdExtend
Selection.Copy
dDoc.Activate
Selection.EndKey unit:=wdStory
Selection.Range.Text = vbCrLf
Selection.PasteSpecial datatype:=wdPasteText
ThisDocument.Activate
Selection.MoveRight unit:=wdWord, Count:=1
Loop
End With
Debug.Print fString & " - "; fCount & " volte"
End With
Application.ScreenUpdating = True
MsgBox ("Completato...")
End Sub
Torna a Applicazioni Office Windows
Excel Estrazione casuale testo da colonna per bingo ca**ate Autore: Dylan666 |
Forum: Applicazioni Office Windows Risposte: 7 |
[EXCEL] Inserire righe in base ad una scelta Autore: robist84@gmail.com |
Forum: Applicazioni Office Windows Risposte: 1 |
EXCEL - Estrazione nome file senza estensione da percorso Autore: Dylan666 |
Forum: Applicazioni Office Windows Risposte: 6 |
Visitano il forum: Nessuno e 24 ospiti