ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Pressing a CommandButton on a Userform via Code (https://www.excelbanter.com/excel-programming/381493-pressing-commandbutton-userform-via-code.html)

Corey

Pressing a CommandButton on a Userform via Code
 
I want to have a user click a Commandbutton on Userform5 that will Show
Userform8.
This is OK,
Userform8 has a CommandButton1 to View a Sheet in PrintPreview.
How can i get the Userform8 CommandButton to to Coded to Run to the Preview
with out having to press it ?


I tried:
Call Userform8.Commandbutton1 but get an error
also tried:

Call CommandButton1 but still get an error.

How can this be done?
Corey....



NickHK

Pressing a CommandButton on a Userform via Code
 
Corey,
CommandButton1.Value = True

NickHK

"Corey" wrote in message
...
I want to have a user click a Commandbutton on Userform5 that will Show
Userform8.
This is OK,
Userform8 has a CommandButton1 to View a Sheet in PrintPreview.
How can i get the Userform8 CommandButton to to Coded to Run to the

Preview
with out having to press it ?


I tried:
Call Userform8.Commandbutton1 but get an error
also tried:

Call CommandButton1 but still get an error.

How can this be done?
Corey....





Corey

Pressing a CommandButton on a Userform via Code
 
Hmm.
Still a bit puzzled.

So how would I :
Using Commandbutton3 on Userform5 i copied the code that i normally use to
unload the uersorm data into a sheet.
i want to add at the end of this code the following:
Userform4.Show & use the value that was in Userform5.Textbox195 as the
selected value in Userform4.Combobox1.value,
then Press the CommandButton1 of Userform4(CommandButton1.Value = True),
then
this Button inputs data from the sheet that Userform5 also add data to,
thendisplays a 1 page sheet with the data placed in the relative cells in
Print Preview mode.

I am having trouble carrying the value from Userform5 through to Userform4,
and getting each of the Userforms no longer require to Close off correctly.

Any idea's of the most efective way to do this?

I tried copying ALL code into the CommandButton3 code on Userform5 but it
took forever and stalled at stages with errors.

Corey....



"Corey" wrote in message
...
I want to have a user click a Commandbutton on Userform5 that will Show
Userform8.
This is OK,
Userform8 has a CommandButton1 to View a Sheet in PrintPreview.
How can i get the Userform8 CommandButton to to Coded to Run to the
Preview with out having to press it ?


I tried:
Call Userform8.Commandbutton1 but get an error
also tried:

Call CommandButton1 but still get an error.

How can this be done?
Corey....




NickHK

Pressing a CommandButton on a Userform via Code
 
Corey,
Not sure about everything you're after, but....

with Userform4
.load 'but not show yet
.Combobox1.value=userform5.textbox195.text
userform5.hide
'or
unload userform5
.show 'vbmodal or vbmodeless
end with

NickHK

"Corey" wrote in message
...
Hmm.
Still a bit puzzled.

So how would I :
Using Commandbutton3 on Userform5 i copied the code that i normally use

to
unload the uersorm data into a sheet.
i want to add at the end of this code the following:
Userform4.Show & use the value that was in Userform5.Textbox195 as the
selected value in Userform4.Combobox1.value,
then Press the CommandButton1 of Userform4(CommandButton1.Value = True),
then
this Button inputs data from the sheet that Userform5 also add data to,
thendisplays a 1 page sheet with the data placed in the relative cells in
Print Preview mode.

I am having trouble carrying the value from Userform5 through to

Userform4,
and getting each of the Userforms no longer require to Close off

correctly.

Any idea's of the most efective way to do this?

I tried copying ALL code into the CommandButton3 code on Userform5 but it
took forever and stalled at stages with errors.

Corey....



"Corey" wrote in message
...
I want to have a user click a Commandbutton on Userform5 that will Show
Userform8.
This is OK,
Userform8 has a CommandButton1 to View a Sheet in PrintPreview.
How can i get the Userform8 CommandButton to to Coded to Run to the
Preview with out having to press it ?


I tried:
Call Userform8.Commandbutton1 but get an error
also tried:

Call CommandButton1 but still get an error.

How can this be done?
Corey....






Corey

Pressing a CommandButton on a Userform via Code
 
What does this do:
'vbmodal or vbmodeless

??
"NickHK" wrote in message
...
Corey,
Not sure about everything you're after, but....

with Userform4
.load 'but not show yet
.Combobox1.value=userform5.textbox195.text
userform5.hide
'or
unload userform5
.show 'vbmodal or vbmodeless
end with

NickHK

"Corey" wrote in message
...
Hmm.
Still a bit puzzled.

So how would I :
Using Commandbutton3 on Userform5 i copied the code that i normally use

to
unload the uersorm data into a sheet.
i want to add at the end of this code the following:
Userform4.Show & use the value that was in Userform5.Textbox195 as the
selected value in Userform4.Combobox1.value,
then Press the CommandButton1 of Userform4(CommandButton1.Value = True),
then
this Button inputs data from the sheet that Userform5 also add data to,
thendisplays a 1 page sheet with the data placed in the relative cells in
Print Preview mode.

I am having trouble carrying the value from Userform5 through to

Userform4,
and getting each of the Userforms no longer require to Close off

correctly.

Any idea's of the most efective way to do this?

I tried copying ALL code into the CommandButton3 code on Userform5 but it
took forever and stalled at stages with errors.

Corey....



"Corey" wrote in message
...
I want to have a user click a Commandbutton on Userform5 that will Show
Userform8.
This is OK,
Userform8 has a CommandButton1 to View a Sheet in PrintPreview.
How can i get the Userform8 CommandButton to to Coded to Run to the
Preview with out having to press it ?


I tried:
Call Userform8.Commandbutton1 but get an error
also tried:

Call CommandButton1 but still get an error.

How can this be done?
Corey....








Chip Pearson

Pressing a CommandButton on a Userform via Code
 
What does this do:
'vbmodal or vbmodeless


It indicates that either the vbModal or the vbModeless constant value should
be provided to the Show command. With vbModal, you can interact only with
the form until the form is hidden or unloaded. You can't access anything
outside the form, and code execution pauses on the Show statement until the
form is dismissed. With vbModeless, the form is shown and execution proceeds
past the Show statement. With a modeless form, you can interact with the
Excel environment while the form is still visible. If neither vbModal or
vbModeless parameter is omitted the form is show modal unless the ShowModal
property is set to False.



--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
(email address is on the web site)


"Corey" wrote in message
...
What does this do:
'vbmodal or vbmodeless

??
"NickHK" wrote in message
...
Corey,
Not sure about everything you're after, but....

with Userform4
.load 'but not show yet
.Combobox1.value=userform5.textbox195.text
userform5.hide
'or
unload userform5
.show 'vbmodal or vbmodeless
end with

NickHK

"Corey" wrote in message
...
Hmm.
Still a bit puzzled.

So how would I :
Using Commandbutton3 on Userform5 i copied the code that i normally use

to
unload the uersorm data into a sheet.
i want to add at the end of this code the following:
Userform4.Show & use the value that was in Userform5.Textbox195 as the
selected value in Userform4.Combobox1.value,
then Press the CommandButton1 of Userform4(CommandButton1.Value = True),
then
this Button inputs data from the sheet that Userform5 also add data to,
thendisplays a 1 page sheet with the data placed in the relative cells
in
Print Preview mode.

I am having trouble carrying the value from Userform5 through to

Userform4,
and getting each of the Userforms no longer require to Close off

correctly.

Any idea's of the most efective way to do this?

I tried copying ALL code into the CommandButton3 code on Userform5 but
it
took forever and stalled at stages with errors.

Corey....



"Corey" wrote in message
...
I want to have a user click a Commandbutton on Userform5 that will
Show
Userform8.
This is OK,
Userform8 has a CommandButton1 to View a Sheet in PrintPreview.
How can i get the Userform8 CommandButton to to Coded to Run to the
Preview with out having to press it ?


I tried:
Call Userform8.Commandbutton1 but get an error
also tried:

Call CommandButton1 but still get an error.

How can this be done?
Corey....











All times are GMT +1. The time now is 08:57 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com