Re : Making use of the Built-in Dialog Boxes

T

TKT-Tang

1. Please examine the following code :-

Dim TextFind As String
Call Application.Dialogs(xlDialogFormulaFind).Show(TextFind, 2, 2, 1,
0, True, True)
MsgBox "TextFind = " & TextFind

2. It is in vain to store the text string (entered into the Find What
: text box of the built-in xlDialogFormulaFind) by using the argument
TextFind.

3. Please show the alternative means of capturing TextFind by using
VBA code.

4. Regards.
 
P

Patrick Molloy

Use the FIND method...look in Help. There are some very
good code examples therein.

With Worksheets(1).Range("a1:a500")
Set c = .Find(2, lookin:=xlValues)
If Not c Is Nothing Then
firstAddress = c.Address
Do
c.Value = 5
Set c = .FindNext(c)
Loop While Not c Is Nothing And c.Address <>
firstAddress
End If
End With

Patrick Molloy
Microsoft Excel MVP
 
B

Bill Manville

TKT-Tang said:
3. Please show the alternative means of capturing TextFind by using
VBA code.
I think there is none.

You would do better to get the TextFind via an InputBox and then use it
in the Find method.

Bill Manville
MVP - Microsoft Excel, Oxford, England
No email replies please - reply in newsgroup
 
T

TKT-Tang

Mr. Manville and Mr Molloy,

Thank you for your replies.

Regards.

Yours faithfully,

TKT-Tang.
 
Top