Bacalhau75
New Member
- Joined
- Jul 9, 2014
- Messages
- 12
Hello. I can usually figure out code when i'm stuck, but i've spent hours on this and need help.
I've been asked to help update publisher documents. I normally automate every task, but can't seem to automate this the way i want to.
My first issue is, after i find a certain phrase, i'm able to replace it. But if I have to add a new bullet in an outline, i cannot mimmic 'ENTER' which brings down the next letter and types out the text. Iv'e tried Vbtab, vbcr vbctrl (i can't get these to work period, and i never use this in my regular excel vba code. Not sure if it requires references set, i looked around but didn't see any. I usually use CHR(10) and CHR(13) if i have do to any type of carriage returns.
I gave up on the above for now and i need to confirm if certain words exist on a document, if not i need to close the doc and proceed to the next one.
This code below, i found on Microsoft help files and for some reason it only works the first time, afterwards '.FoundTextRange' is always set to NOTHING.
I tried changing the above code by removing the loop, and adding my own boolean statement. The first time (in the loop search) .FoundTextRange = "Thewords i'm searching", after that it's always 'Nothing'
Any help would be appreciated.
I've been asked to help update publisher documents. I normally automate every task, but can't seem to automate this the way i want to.
My first issue is, after i find a certain phrase, i'm able to replace it. But if I have to add a new bullet in an outline, i cannot mimmic 'ENTER' which brings down the next letter and types out the text. Iv'e tried Vbtab, vbcr vbctrl (i can't get these to work period, and i never use this in my regular excel vba code. Not sure if it requires references set, i looked around but didn't see any. I usually use CHR(10) and CHR(13) if i have do to any type of carriage returns.
I gave up on the above for now and i need to confirm if certain words exist on a document, if not i need to close the doc and proceed to the next one.
This code below, i found on Microsoft help files and for some reason it only works the first time, afterwards '.FoundTextRange' is always set to NOTHING.
VBA Code:
Dim objFind as FindReplace
Dim fFound as Boolean
Set objFind = ActiveDocument.Find
fFound = True
With objFind
.Clear
.FindText = "Important"
Do While fFound = True
fFound = .Execute
If Not .FoundTextRange Is Nothing Then
.FoundTextRange.Font.Bold = True
End If
Loop
End With
I tried changing the above code by removing the loop, and adding my own boolean statement. The first time (in the loop search) .FoundTextRange = "Thewords i'm searching", after that it's always 'Nothing'
Any help would be appreciated.