Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: VBScript Excel
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
objXL.Range("A1").Select
 
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?
 
Thanks
Posted 18-May-11 0:16am
Comments
losmac at 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

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

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 :(
  Permalink  

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

  Print Answers RSS
0 OriginalGriff 6,803
1 Sergey Alexandrovich Kryukov 6,377
2 DamithSL 5,421
3 Manas Bhardwaj 4,841
4 Maciej Los 4,330


Advertise | Privacy | Mobile
Web01 | 2.8.1411023.1 | Last Updated 1 Jun 2011
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100