Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 63
Default Programming the VBE Find/Replace dialog?

In programming the VBE, is there any way to show it's Find/Replace dialog.
E.g., in programming Excel I could code:

Application.Dialogs(xlDialogFormulaReplace).Show

and get the Find/Replace for Excel. Any way to program the VBE one?

Thanks,

Doug

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,290
Default Programming the VBE Find/Replace dialog?

Doug,
This seems to work, however, I have done very little programming dealing
with the VBE.
'--
Sub Experiment()
Dim cmdBar As CommandBar
Set cmdBar = Application.VBE.CommandBars("Menu Bar")
cmdBar.Controls("Edit").Controls("Find...").Execut e
Set cmdBar = Nothing
End Sub
'--

You might also want to experiment with code that Chip Pearson posted
in the Misc group today under "Code to Find Code"...
Sub AAA()
Dim FindWhat As String
Dim StartLine As Long
Dim EndLine As Long
Dim StartCol As Long
Dim EndCol As Long
Dim Found As Boolean

With Application.VBE
If .ActiveCodePane Is Nothing Then
MsgBox "No Code Pane Active"
Exit Sub
End If
With .ActiveCodePane
FindWhat = "findme"
StartLine = 0
EndLine = .CodeModule.CountOfLines
StartCol = 0
EndCol = 0
Found = .CodeModule.Find( _
target:=FindWhat, _
StartLine:=StartLine, _
startcolumn:=StartCol, _
EndLine:=EndLine, _
endcolumn:=EndCol, _
wholeword:=False, _
MatchCase:=False, _
PatternSearch:=False)
If Found = True Then
.SetSelection StartLine, StartCol, EndLine, EndCol
Else
MsgBox "Not Found"
End If
End With
End With
End Sub
'----------
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware
(Excel Add-ins / Excel Programming)



"Doug Glancy"
wrote in message
In programming the VBE, is there any way to show it's Find/Replace dialog.
E.g., in programming Excel I could code:
Application.Dialogs(xlDialogFormulaReplace).Show
and get the Find/Replace for Excel. Any way to program the VBE one?
Thanks,
Doug

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 63
Default Programming the VBE Find/Replace dialog?

Jim and Greg,

Thanks. I am already working with some code of Chip's for finding code. At
some point I thought it would be great to bring up the Find/Replace dialog,
and fill in the args the way I could with the Excel dialog. Since it
doesn't look like I can do that without fiddling as Greg described, I'll
probably just stick with code like Chip's all the way.

Thanks,

Doug

"Jim Cone" wrote in message
...
Doug,
This seems to work, however, I have done very little programming dealing
with the VBE.
'--
Sub Experiment()
Dim cmdBar As CommandBar
Set cmdBar = Application.VBE.CommandBars("Menu Bar")
cmdBar.Controls("Edit").Controls("Find...").Execut e
Set cmdBar = Nothing
End Sub
'--

You might also want to experiment with code that Chip Pearson posted
in the Misc group today under "Code to Find Code"...
Sub AAA()
Dim FindWhat As String
Dim StartLine As Long
Dim EndLine As Long
Dim StartCol As Long
Dim EndCol As Long
Dim Found As Boolean

With Application.VBE
If .ActiveCodePane Is Nothing Then
MsgBox "No Code Pane Active"
Exit Sub
End If
With .ActiveCodePane
FindWhat = "findme"
StartLine = 0
EndLine = .CodeModule.CountOfLines
StartCol = 0
EndCol = 0
Found = .CodeModule.Find( _
target:=FindWhat, _
StartLine:=StartLine, _
startcolumn:=StartCol, _
EndLine:=EndLine, _
endcolumn:=EndCol, _
wholeword:=False, _
MatchCase:=False, _
PatternSearch:=False)
If Found = True Then
.SetSelection StartLine, StartCol, EndLine, EndCol
Else
MsgBox "Not Found"
End If
End With
End With
End Sub
'----------
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware
(Excel Add-ins / Excel Programming)



"Doug Glancy"
wrote in message
In programming the VBE, is there any way to show it's Find/Replace dialog.
E.g., in programming Excel I could code:
Application.Dialogs(xlDialogFormulaReplace).Show
and get the Find/Replace for Excel. Any way to program the VBE one?
Thanks,
Doug


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 747
Default Programming the VBE Find/Replace dialog?

With Application.VBE.CommandBars("Standard")
.FindControl(ID:=141).Execute
End With

Going from there, if you wish to mainipulate its controls, you could either
use SendKeys or the FindWindowEx API. I have noted that the dialog's
individual controls are Windows common controls. Two are "ComboBox" type and
the others (including checkboxes) are the "Button" type which you can access
with FindWindowEx. Unless this is an important project, SendKeys would be a
lot easier. FindWindowEx is likely to be a lot more reliable but more work to
set up.

Greg

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Programming the Find Dialog Box kirkm[_7_] Excel Programming 1 August 1st 07 07:21 AM
FIND AND REPLACE DIALOG BOX MoreGOOFS Excel Discussion (Misc queries) 1 June 24th 06 12:46 PM
Excel Find/Replace Dialog Box ajaxford Excel Discussion (Misc queries) 2 June 16th 06 06:28 AM
Pulling up the Find and Replace Dialog via Code kraljb[_19_] Excel Programming 1 January 11th 06 09:23 PM
Find/Replace built-in dialog in XP kevboy Excel Programming 2 December 19th 05 08:59 PM


All times are GMT +1. The time now is 12:37 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"