PDA

View Full Version : Solved: Automatically Populate Input Box Presented?



Ice-Tea-Jan
07-19-2011, 11:05 AM
Hello,

I wish to have VBA automatically populate the input box that is presented in this code with the string: “^?” (in order to find ANY character) in non-black text.

I’ve tried a number of things (including sendkeys, etc.) but I am truly spinning my wheels!

Can anybody offer me help on this?


Sub FindNotBlack()
With Selection.Find
.ClearFormatting
.Text = InputBox(prompt:="Enter the search text.", _
Title:="Find Nonblack Text")
Do While .Execute
With Selection.Font
If (.Color <> wdColorAutomatic) And _
(.Color <> wdColorBlack) Then
MsgBox "Found"
Exit Sub
End If
End With
Loop
End With
End Sub


Thanking you,
Janet:dunno

gmaxey
07-19-2011, 11:35 AM
Add the "Default" parameter.

Sub FindNotBlack()
With Selection.Find
.ClearFormatting
.Text = InputBox(prompt:="Enter the search text.", _
Title:="Find Nonblack Text", Default:="^?")
Do While .Execute
With Selection.Font
If (.Color <> wdColorAutomatic) And _
(.Color <> wdColorBlack) Then
MsgBox "Found"
Exit Sub
End If
End With
Loop
End With
End Sub

Ice-Tea-Jan
07-19-2011, 04:35 PM
Greg,
Thank you VERY much for your quick and correct response!
I saw “default” within the VBA “autotip” as I was experimenting; but obviously did not know how to use it!
Having the last piece of this code is very helpful to me. (I needed that last push!)
I’m marking this thread solved, and sending a donation.
Thanks again, Greg. Superb support!:hi:
Janet

gmaxey
07-19-2011, 06:17 PM
Jan,

Glad I could help. I don't know who the recipient of the donation will be, but I am sure they will appreciate your support as well.

Ice-Tea-Jan
07-19-2011, 06:51 PM
Hope that was the right way to go.

Janet