98.7% Of all customers recommend us, we're so confident about our results we publish all reviews and stats
View Live Stats View ReviewsForum home » Delegate support and help forum » Microsoft Excel VBA Training and help » Reports forms coding
Reports forms coding
Resolved · High Priority · Version 2010
Martin has attended:
Excel Advanced course
Excel Advanced - Formulas & Functions course
Excel Advanced - For Power Users course
Excel VBA Intro Intermediate course
Excel VBA Advanced course
Reports forms coding
Hi Support,
I have written a large procedure that I would like to execute once I have received some user input information. For this I have created a form, which opens as soon as the excel document is opened. The user enters the data required, clicks the OK command button and the data is returned to the excel document. I then have a command to unload the form. As soon as this is done, I then want to call the procedure I have written. For some reason I cannot seem to call the procedure from the code in the form. Please see below:-
Private Sub cmdOK_Click()
Load StyleImportForm
Dim tb1 As Range
Dim tb2 As Range
Dim tb3 As Range
Set tb1 = Sheets("SeasonCodeTable").Range("F2")
Set tb2 = Sheets("SeasonCodeTable").Range("F3")
Set tb3 = Sheets("SeasonCodeTable").Range("F4")
tb1.Value = TextBox1.Value
tb2.Value = TextBox2.Value
tb3.Value = TextBox3.Value / 100
Unload StyleImportForm
Call ScotchStyleImport
End Sub
Private Sub UserForm_Initialize()
TextBox1.Value = "0.00"
TextBox2.Value = "0.00"
TextBox3.Value = "0"
End Sub
Any ideas why this is not working.
Thanks
Martin
RE: Reports forms coding
Hi Martin
Good to hear from you again. I can't think of a reason why the ScotchStyleImport routine wouldn't fire, so something's happening there.
It's difficult to debug routines inside a form; does the routine work if you execute it standalone (not inside the form)?
If it does, create a breakpoint on the Call line. To do this click inside the line of code and press F9. When the event next happens the execution will freeze at that line. You can then perform a Step Through (F5) to work out whether the event is even occurring.
That should uncover the issue - then we can tackle that!
Kind regards
Gary Fenn
Microsoft Office Specialist Trainer
Tel: 0207 987 3777
Best STL - https://www.stl-training.co.uk
98%+ recommend us
London's leader with UK wide delivery in Microsoft Office training and management training to global brands, FTSE 100, SME's and the public sector
Wed 3 Jul 2013: Automatically marked as resolved.
Training information:
Welcome. Please choose your application (eg. Excel) and then post your question. Our Microsoft Qualified trainers will then respond within 24 hours (working days). Frequently Asked Questions
Any suggestions, questions or comments? Please post in the Improve the forum thread. |
Excel tip:Status Bar FunctionsWhen using the SUM, MIN, MAX, AVERAGE and COUNT functions, the result of such calculations are displayed in the worksheet. |