Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 49
Default Controlling dialog programatically

I have a programme that contains 4 User Forms, all of which display data. I
can print them individually by means of a macro connected to a button (PRINT)
on each user form. However, I cannot make all of them print from a single
click.

The problem is that the first user form will print, but when I unload that
and then show the next form, the system sits there waiting for the user to
click a button on that new form.

Is there any way that I can instruct the system to print each user form in
turn (i.e. the equivalent of the user pressing the PRINT) and then proceed
onto the next user form, without the need for user intervention.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,120
Default Controlling dialog programatically

Don't unload it, hide it, it will then still be part of the forms collection

--
HTH

Bob Phillips

"IanC" wrote in message
...
I have a programme that contains 4 User Forms, all of which display data.

I
can print them individually by means of a macro connected to a button

(PRINT)
on each user form. However, I cannot make all of them print from a single
click.

The problem is that the first user form will print, but when I unload that
and then show the next form, the system sits there waiting for the user to
click a button on that new form.

Is there any way that I can instruct the system to print each user form in
turn (i.e. the equivalent of the user pressing the PRINT) and then proceed
onto the next user form, without the need for user intervention.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 121
Default Controlling dialog programatically

Can you clarify one thing?Will all four forms will be loaded and in view at
the same time, prior to printing? I have tried to open two userforms at the
same time, either with external code or by trying to make one form show the
other (using FRM2.Show somewhere in the code module of FRM1) and it didn't
work.

Will one of the forms have "THE" Print button? So in clicking the Print
button on Form 1, it is supposed to Print itself and the other three? -- or
will "THE" Print button be on a worksheet?




"IanC" wrote in message
...
I have a programme that contains 4 User Forms, all of which display data.
I
can print them individually by means of a macro connected to a button
(PRINT)
on each user form. However, I cannot make all of them print from a single
click.

The problem is that the first user form will print, but when I unload that
and then show the next form, the system sits there waiting for the user to
click a button on that new form.

Is there any way that I can instruct the system to print each user form in
turn (i.e. the equivalent of the user pressing the PRINT) and then proceed
onto the next user form, without the need for user intervention.



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 49
Default Controlling dialog programatically

Hi Bob,

Thanks for the quick response. Unfortunately, I am still getting the same
problem - when the system shows the second user form it just waits for the
user to click a button on the User Form before proceeding with the print.

I cannot see how to initiate the second (and subsequent) prints without user
intervention.

"Bob Phillips" wrote:

Don't unload it, hide it, it will then still be part of the forms collection

--
HTH

Bob Phillips

"IanC" wrote in message
...
I have a programme that contains 4 User Forms, all of which display data.

I
can print them individually by means of a macro connected to a button

(PRINT)
on each user form. However, I cannot make all of them print from a single
click.

The problem is that the first user form will print, but when I unload that
and then show the next form, the system sits there waiting for the user to
click a button on that new form.

Is there any way that I can instruct the system to print each user form in
turn (i.e. the equivalent of the user pressing the PRINT) and then proceed
onto the next user form, without the need for user intervention.




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 49
Default Controlling dialog programatically

Ideally, they would not all bel oaded and in view at the same time - although
if that were to be what it takes, it would not be a problem. All four Forms
have their own PRINT button that prints that Form alone. I was planning to
put a PRINT ALL button just on the first Form.

Hope this clarifies - many thanks for your interest.



"William Benson" wrote:

Can you clarify one thing?Will all four forms will be loaded and in view at
the same time, prior to printing? I have tried to open two userforms at the
same time, either with external code or by trying to make one form show the
other (using FRM2.Show somewhere in the code module of FRM1) and it didn't
work.

Will one of the forms have "THE" Print button? So in clicking the Print
button on Form 1, it is supposed to Print itself and the other three? -- or
will "THE" Print button be on a worksheet?




"IanC" wrote in message
...
I have a programme that contains 4 User Forms, all of which display data.
I
can print them individually by means of a macro connected to a button
(PRINT)
on each user form. However, I cannot make all of them print from a single
click.

The problem is that the first user form will print, but when I unload that
and then show the next form, the system sits there waiting for the user to
click a button on that new form.

Is there any way that I can instruct the system to print each user form in
turn (i.e. the equivalent of the user pressing the PRINT) and then proceed
onto the next user form, without the need for user intervention.






  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Controlling dialog programatically

Can you not put the code in the Userform_Activate event then?

--

HTH

RP
(remove nothere from the email address if mailing direct)


"IanC" wrote in message
...
Hi Bob,

Thanks for the quick response. Unfortunately, I am still getting the same
problem - when the system shows the second user form it just waits for the
user to click a button on the User Form before proceeding with the print.

I cannot see how to initiate the second (and subsequent) prints without

user
intervention.

"Bob Phillips" wrote:

Don't unload it, hide it, it will then still be part of the forms

collection

--
HTH

Bob Phillips

"IanC" wrote in message
...
I have a programme that contains 4 User Forms, all of which display

data.
I
can print them individually by means of a macro connected to a button

(PRINT)
on each user form. However, I cannot make all of them print from a

single
click.

The problem is that the first user form will print, but when I unload

that
and then show the next form, the system sits there waiting for the

user to
click a button on that new form.

Is there any way that I can instruct the system to print each user

form in
turn (i.e. the equivalent of the user pressing the PRINT) and then

proceed
onto the next user form, without the need for user intervention.






  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 49
Default Controlling dialog programatically

So close. This now prints all the user forms but (and this is wierd) all but
the first one are printed as blank, i.e. no data boxes, no text, just the
container and the caption. However, each form appears correctly on the
screen, and the system seems to be going through the whole print process
correctly.

I have never come across this situation before when using the individual
PRINT macro. For reference purposes the code on the UserForm_activate is:

If Sheets("MASTER SHEET").Range("f24") < "YES" Then Exit Sub
Call PrintThisPage_Click
PriceData.Hide

where the MASTER SHEET value is equal to YES if coming from the
PrintAllSheets macro and PrintThisPage_Click is the macro that prints the
individual UserForm


"Bob Phillips" wrote:

Can you not put the code in the Userform_Activate event then?

--

HTH

RP
(remove nothere from the email address if mailing direct)


"IanC" wrote in message
...
Hi Bob,

Thanks for the quick response. Unfortunately, I am still getting the same
problem - when the system shows the second user form it just waits for the
user to click a button on the User Form before proceeding with the print.

I cannot see how to initiate the second (and subsequent) prints without

user
intervention.

"Bob Phillips" wrote:

Don't unload it, hide it, it will then still be part of the forms

collection

--
HTH

Bob Phillips

"IanC" wrote in message
...
I have a programme that contains 4 User Forms, all of which display

data.
I
can print them individually by means of a macro connected to a button
(PRINT)
on each user form. However, I cannot make all of them print from a

single
click.

The problem is that the first user form will print, but when I unload

that
and then show the next form, the system sits there waiting for the

user to
click a button on that new form.

Is there any way that I can instruct the system to print each user

form in
turn (i.e. the equivalent of the user pressing the PRINT) and then

proceed
onto the next user form, without the need for user intervention.






  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 49
Default Controlling dialog programatically

To answer my own question on this last problem - it is essential to allow
time between activating the UserForm and printing it. This is best achieved
by using something like:

Application.Wait Now + TimeValue("00:00:05")

As the first line of the UserForm_activate macro.

Many thnaks, Bob, for putting me on the right track.


"IanC" wrote:

So close. This now prints all the user forms but (and this is wierd) all but
the first one are printed as blank, i.e. no data boxes, no text, just the
container and the caption. However, each form appears correctly on the
screen, and the system seems to be going through the whole print process
correctly.

I have never come across this situation before when using the individual
PRINT macro. For reference purposes the code on the UserForm_activate is:

If Sheets("MASTER SHEET").Range("f24") < "YES" Then Exit Sub
Call PrintThisPage_Click
PriceData.Hide

where the MASTER SHEET value is equal to YES if coming from the
PrintAllSheets macro and PrintThisPage_Click is the macro that prints the
individual UserForm


"Bob Phillips" wrote:

Can you not put the code in the Userform_Activate event then?

--

HTH

RP
(remove nothere from the email address if mailing direct)


"IanC" wrote in message
...
Hi Bob,

Thanks for the quick response. Unfortunately, I am still getting the same
problem - when the system shows the second user form it just waits for the
user to click a button on the User Form before proceeding with the print.

I cannot see how to initiate the second (and subsequent) prints without

user
intervention.

"Bob Phillips" wrote:

Don't unload it, hide it, it will then still be part of the forms

collection

--
HTH

Bob Phillips

"IanC" wrote in message
...
I have a programme that contains 4 User Forms, all of which display

data.
I
can print them individually by means of a macro connected to a button
(PRINT)
on each user form. However, I cannot make all of them print from a

single
click.

The problem is that the first user form will print, but when I unload

that
and then show the next form, the system sits there waiting for the

user to
click a button on that new form.

Is there any way that I can instruct the system to print each user

form in
turn (i.e. the equivalent of the user pressing the PRINT) and then

proceed
onto the next user form, without the need for user intervention.






  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 233
Default Controlling dialog programatically

IanC

pls seperate the actual print code from the Userforms into the
workbook. This way you get print macro's (e.g. print1 to print4) in a
global module.
When doing a printall just run all 4 print macro's after eachother.

DM Unseen

  #10   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 49
Default Controlling dialog programatically

Many thanks for this suggestion. The Print macro uses a PrintScreen routine
and hence the dialog box itself needs to be displayed and that was where I
was having the problem.

However, I think that Bob's idea (above) regarding using a Userform_activate
macro, together with my discovery that the system needs to be allowed ample
time to redraw the screen before trying to print it, will resolve the problem.

"DM Unseen" wrote:

IanC

pls seperate the actual print code from the Userforms into the
workbook. This way you get print macro's (e.g. print1 to print4) in a
global module.
When doing a printall just run all 4 print macro's after eachother.

DM Unseen




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to delete the "Insert Function Dialog Box" (dialog box only)? TBI''d biker Excel Worksheet Functions 2 April 7th 07 09:18 PM
programatically creating dialog box [email protected] Excel Programming 1 March 20th 05 10:51 PM
control of dialog macro dialog box. on open Gerry Abbott Excel Programming 0 July 22nd 04 05:41 PM
Programatically set ref to my DLL ricks Excel Programming 2 April 13th 04 03:08 PM
Controlling VBA MWE[_3_] Excel Programming 2 January 13th 04 07:23 PM


All times are GMT +1. The time now is 02:32 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"