Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#11
Posted to microsoft.public.excel.programming
|
|||
|
|||
Controlling dialog programatically
I'd like to see the finished result if you coult e-mail it to me? Maybe just
the forms and code without anything proprietary? I am fascinated, thanks. My e-mail is without the (NOSPAM). Thanks "IanC" wrote in message ... 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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How to delete the "Insert Function Dialog Box" (dialog box only)? | Excel Worksheet Functions | |||
programatically creating dialog box | Excel Programming | |||
control of dialog macro dialog box. on open | Excel Programming | |||
Programatically set ref to my DLL | Excel Programming | |||
Controlling VBA | Excel Programming |