VBA->How to create an event.

VBA->How to create an event.

Post by T Bennet » Fri, 02 Mar 2001 06:25:56



I need a Private Sub to start when my form appears (grabbing information to
fill in the form).  My VBA is so rusty, I don't know how to start this event
without a Click event.

I have a checkbox whose value is true.  This should signal the Sub to grab
the information from the Custom Properties as soon as the form is active.

I've overhauled a VBA program from Rhapsody Design Solutions which updates
the custom properties.(It doesn't look much like did).

Thanks ~ Todd

 
 
 

VBA->How to create an event.

Post by Ryan Smal » Fri, 02 Mar 2001 06:29:00


Call the sub from the INITIALIZE event of the userform.

            Ryan


Quote:> I need a Private Sub to start when my form appears (grabbing information
to
> fill in the form).  My VBA is so rusty, I don't know how to start this
event
> without a Click event.

> I have a checkbox whose value is true.  This should signal the Sub to grab
> the information from the Custom Properties as soon as the form is active.

> I've overhauled a VBA program from Rhapsody Design Solutions which updates
> the custom properties.(It doesn't look much like did).

> Thanks ~ Todd


 
 
 

VBA->How to create an event.

Post by T Bennet » Fri, 02 Mar 2001 08:05:39


Well I have called the click event, but it isn't running.  What am missing?

Example:
_____________________________________
Private Sub cmd_grab_info_Click()
bla bla bla
End Sub
_____________________________________
yada yada
____________________________________
Private Sub frm_solidworks_form_Initialize()
cmd_grab_info_Click
End Sub
_____________________________________

Thanks ~ Todd


Quote:> Call the sub from the INITIALIZE event of the userform.

>             Ryan

 
 
 

VBA->How to create an event.

Post by Robert V. Hanso » Fri, 02 Mar 2001 08:32:27


Bob Hanson Wrote:

Perhaps an easier way is to take the code that exists under the command
button click evet and build a seperate subprocedure.  You can then place
this subprocedure in a seperate module for easier maintenance.  Please be
sure to declare as a Sub not a Private Sub so the rest of the application
can find it.

You can then call the new subprocedure fromt the userform initialize event
as well as the command button click event if you so wish.

Hope this helps,

--
Bob Hanson
CEO
Custom Programming Unlimited LLC
SolidWorks Double Solution Partner (SW API training/consulting and SW PDM
provider)
www.powerweb.net/cpu website


> Well I have called the click event, but it isn't running.  What am
missing?

> Example:
> _____________________________________
> Private Sub cmd_grab_info_Click()
> bla bla bla
> End Sub
> _____________________________________
> yada yada
> ____________________________________
> Private Sub frm_solidworks_form_Initialize()
> cmd_grab_info_Click
> End Sub
> _____________________________________

> Thanks ~ Todd



> > Call the sub from the INITIALIZE event of the userform.

> >             Ryan

 
 
 

VBA->How to create an event.

Post by T Bennet » Fri, 02 Mar 2001 09:50:31


I think we're missing the whole "trouble calling the subprocedure from the
userform initialize" thingy.
I calls it, but it aint be comin.

It works fine from the click procedure.



Quote:> Bob Hanson Wrote:

> Perhaps an easier way is to take the code that exists under the command
> button click evet and build a seperate subprocedure.  You can then place
> this subprocedure in a seperate module for easier maintenance.  Please be
> sure to declare as a Sub not a Private Sub so the rest of the application
> can find it.

> You can then call the new subprocedure fromt the userform initialize event
> as well as the command button click event if you so wish.

> Hope this helps,

> --
> Bob Hanson
> CEO
> Custom Programming Unlimited LLC
> SolidWorks Double Solution Partner (SW API training/consulting and SW PDM
> provider)

 
 
 

VBA->How to create an event.

Post by Jason Swackhame » Fri, 02 Mar 2001 10:14:37


I'm not that familiar with VBA (using VB6), but just took a look, and there
is a "UserForm_Activate" handler that looks like it may do what you're
looking for.

-Jason S.


Quote:> I need a Private Sub to start when my form appears (grabbing information
to
> fill in the form).  My VBA is so rusty, I don't know how to start this
event
> without a Click event.

> I have a checkbox whose value is true.  This should signal the Sub to grab
> the information from the Custom Properties as soon as the form is active.

> I've overhauled a VBA program from Rhapsody Design Solutions which updates
> the custom properties.(It doesn't look much like did).

> Thanks ~ Todd

 
 
 

VBA->How to create an event.

Post by Robert V. Hanso » Fri, 02 Mar 2001 11:36:18


Bob Hanson Wrote:

The reason why you code doesn't work is because you need to remove the
keyword Private from the Private Sub ...Click routine.  This will allow the
code to see the subprocedure.

Hope this helps..

--
Bob Hanson
CEO
Custom Programming Unlimited LLC
SolidWorks Double Solution Partner (SW API training/consulting and SW PDM
provider)
www.powerweb.net/cpu website


> I think we're missing the whole "trouble calling the subprocedure from the
> userform initialize" thingy.
> I calls it, but it aint be comin.

> It works fine from the click procedure.



> > Bob Hanson Wrote:

> > Perhaps an easier way is to take the code that exists under the command
> > button click evet and build a seperate subprocedure.  You can then place
> > this subprocedure in a seperate module for easier maintenance.  Please
be
> > sure to declare as a Sub not a Private Sub so the rest of the
application
> > can find it.

> > You can then call the new subprocedure fromt the userform initialize
event
> > as well as the command button click event if you so wish.

> > Hope this helps,

> > --
> > Bob Hanson
> > CEO
> > Custom Programming Unlimited LLC
> > SolidWorks Double Solution Partner (SW API training/consulting and SW
PDM
> > provider)

 
 
 

VBA->How to create an event.

Post by Steve F » Fri, 02 Mar 2001 12:15:27


On Wed, 28 Feb 2001 20:36:18 -0600, "Robert V. Hanson"


>Bob Hanson Wrote:

>The reason why you code doesn't work is because you need to remove the
>keyword Private from the Private Sub ...Click routine.  This will allow the
>code to see the subprocedure.

>Hope this helps..

>--
>Bob Hanson
>CEO
>Custom Programming Unlimited LLC
>SolidWorks Double Solution Partner (SW API training/consulting and SW PDM
>provider)
>www.powerweb.net/cpu website



>> I think we're missing the whole "trouble calling the subprocedure from the
>> userform initialize" thingy.
>> I calls it, but it aint be comin.

>> It works fine from the click procedure.



>> > Bob Hanson Wrote:

>> > Perhaps an easier way is to take the code that exists under the command
>> > button click evet and build a seperate subprocedure.  You can then place
>> > this subprocedure in a seperate module for easier maintenance.  Please
>be
>> > sure to declare as a Sub not a Private Sub so the rest of the
>application
>> > can find it.

>> > You can then call the new subprocedure fromt the userform initialize
>event
>> > as well as the command button click event if you so wish.

>> > Hope this helps,

>> > --
>> > Bob Hanson
>> > CEO
>> > Custom Programming Unlimited LLC
>> > SolidWorks Double Solution Partner (SW API training/consulting and SW
>PDM
>> > provider)

Just wanted to say "Thanks" Bob for helping out Mr. Bennett for a
program of my creation.  I hope it doesn't lead to too many hours of
tech support for everyone here :-)

Additionally, I want to let everyone here know that I have updated the
program I created with a couple of minor fixes (one paramater was not
getting updated, also modified code so that the color controls update
whenever you press the "Get Info" button.

If anyone has questions pertaining to the software or how it works,
feel free to ask.

Steve Fye
Rhapsody Design Solutions (RDS)
http://www.veryComputer.com/

Remove NOSPAM from the e-mail address to reply via e-mail.

______________________________________________________________________
Posted Via Uncensored-News.Com - Still Only $9.95 - http://www.veryComputer.com/
 With Servers In California, Texas And *ia - The Worlds Uncensored News Source