planetshwee
New Member
- Joined
- Oct 12, 2006
- Messages
- 1
Hi, this is my first post so please bear with me if I don't give all the info required -
I am writing a control sheet that generates several reports (spreadsheets) from some source data (text file). I am nearly finished but am having one last problem -
The output reports have several levels of detail and I an have added three commandbuttons to the file, each will select a different criteria in a hidden autofilter at the end of the report (column O) thus select the different levels. I have written and exported three little macros to this effect and am then importing the module into each of the outputted reports, code as below -
Application.VBE.ActiveVBProject.VBComponents.Import "C:\EDD\MODULE1.bas
I did the following to create the buttons (x3 per worksheet) -
MyActualWorksheet.OLEObjects.Add ClassType:="Forms.CommandButton.1", Link:=False, DisplayAsIcon:=False, Left:=15.9, Top:=35.3, Width:=82.1, Height:=24.7
MyActualWorksheet.OLEObjects("CommandButton1").Object.Caption = "GL Detail"
What I can't figure out how to do is assign the filtering macro's to the buttons (the code needs to be written in the control file and not the spreadsheet with the buttons and it is this that is causing me problems). If it helps, "MyActualWorksheet" is one of the worksheets in the output reports.
Please help as Eddie is a confused little lad and a bit of a beginner in the world of code....
I am writing a control sheet that generates several reports (spreadsheets) from some source data (text file). I am nearly finished but am having one last problem -
The output reports have several levels of detail and I an have added three commandbuttons to the file, each will select a different criteria in a hidden autofilter at the end of the report (column O) thus select the different levels. I have written and exported three little macros to this effect and am then importing the module into each of the outputted reports, code as below -
Application.VBE.ActiveVBProject.VBComponents.Import "C:\EDD\MODULE1.bas
I did the following to create the buttons (x3 per worksheet) -
MyActualWorksheet.OLEObjects.Add ClassType:="Forms.CommandButton.1", Link:=False, DisplayAsIcon:=False, Left:=15.9, Top:=35.3, Width:=82.1, Height:=24.7
MyActualWorksheet.OLEObjects("CommandButton1").Object.Caption = "GL Detail"
What I can't figure out how to do is assign the filtering macro's to the buttons (the code needs to be written in the control file and not the spreadsheet with the buttons and it is this that is causing me problems). If it helps, "MyActualWorksheet" is one of the worksheets in the output reports.
Please help as Eddie is a confused little lad and a bit of a beginner in the world of code....