David- adding find and goto buttons


Posted by Cory on May 05, 2001 8:36 AM

I've been trying to add find and goto buttons by recording a macro, then cutting and pasting the macro code into the button's "view code" event handler but... when I record a macro no code shows up for these. You have some code? Ivan M. gave me some a month ago but I can't get it to work...
Also, I've deleted every macro I created from every workbook, but Excel still prompts me to enable macros when I try to open one. Do you know how to stop this?

Posted by Ivan Moala on May 05, 2001 8:54 AM

Cory
What code are you using ??
The VBA macro recorder will not record these
application dialogs.
NB: if you are trying to get these to work via
a command button (Activex control) then try
setting the buttons property for Takefocus on click to FALSE.
The code as given should work.

i.e Find CommandBars.FindControl(Id:=1849).Execute

Your 2nd Q

Sub Find()
CommandBars.FindControl(Id:=1849).Execute
End Sub

Sub Go_To()
CommandBars.FindControl(Id:=757).Execute
End Sub

Ivan



Posted by Cory on May 11, 2001 11:14 AM

Thanks Ivan!

I'm new to VBA and am experimenting with a lot of this. I know some VB 5.0 but there are clearly some differences (though slight) between the languages. This MB has has been a wealth of knowledge and resources for me.
Changing the TakeFocus to False was the trick (along with your code, of course!).
Thanks again...

Cory