Click here to Skip to main content
15,847,427 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
i have a vbscript that outputs some data into an excel spreadsheet which is created by the script itself.

What I am trying to do is provide a way for the use to search that spreadsheet by bringing up the find dialog.

I've tried adding a button to the sheet
objXL.ActiveSheet.Buttons.Add(303.75, 16.5, 60, 20).Select
objXL.ActiveSheet.Shapes("Button 1").Select
objXL.Selection.Characters.Text = "Search"
objXL.ActiveSheet.Shapes("Button 1").Select
objXL.Selection.OnAction = ????? ' has to be a macro in the sheet and as the sheet 'is generated by the script, can't see how I can use this method

and assign a function elsewhere in the script to its onAction but this doesn't work.

I know all the user has to do it hit CTRL+F if they want to search, but it would be useful to provide a search button actually on the sheet as its created by the script.

Does anyone have any ideas how to do this please?

Maciej Los 28-May-11 7:29am    
I'm not sure what are you trying to do...
Do you want to call "Find" dialog from MS Excel? Do you want to write own function inside your script? Do you want to add code into sheet?

1 solution

As the script runs it gets the directory structure of a drive and outputs it to excel in a structured fashion. I wanted to be able to include a button on the resulting excel sheet for the user to press in order to call the find dialog, rather than them having to press CTRL+F.

Or include a way on the resulting sheet for the user to perform a search of the folders.

Whatever solution, it has to be included in the excel sheet as a result of coding in the vbscript.

I can't figure out how to do it :(
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900