Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default print command from command button in userform causes double chart

Excel 2007, SP2

I have an activex command button, "CommandButton1" on Sheet1, which issues
command "UserForm1.Show"; in Userform1 I have a command button, "PrintIt"
with the single line "ActiveWorkbook.Sheets("Chart2").PrintPreview" in the
_click event handler. (The same problem occurs with "printout", but this way
I don't waste the paper.)

What happens is, I get the chart in the preview window, but it's as if there
is a smaller version of the chart on top of a larger version. As I
indicated, if I use "...printout" instead of "...printpreview", it prints
this way, too, i.e., with "2 images" of the chart, a smaller superimposed on
a larger.

The same line, "ActiveWorkbook.Sheets("Chart2").PrintPreview" (or
..PrintOut), when attached directly to a command button on the spreadsheet,
works as expected, with only one image of the chart.

Be warned: if you try this with "PrintPreview", it'll hang up the sheet to
the point that only killing it from taskman will get you out.

I can provide a sample if that helps, but there doesn't appear any place to
put an attachment.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,565
Default print command from command button in userform causes double chart

It sounds like you have inadvertantly added a second chart to
Sheets("Chart2").



"Mike Jamesson" wrote in message
...
Excel 2007, SP2

I have an activex command button, "CommandButton1" on Sheet1, which issues
command "UserForm1.Show"; in Userform1 I have a command button, "PrintIt"
with the single line "ActiveWorkbook.Sheets("Chart2").PrintPreview" in the
_click event handler. (The same problem occurs with "printout", but this
way
I don't waste the paper.)

What happens is, I get the chart in the preview window, but it's as if
there
is a smaller version of the chart on top of a larger version. As I
indicated, if I use "...printout" instead of "...printpreview", it prints
this way, too, i.e., with "2 images" of the chart, a smaller superimposed
on
a larger.

The same line, "ActiveWorkbook.Sheets("Chart2").PrintPreview" (or
.PrintOut), when attached directly to a command button on the spreadsheet,
works as expected, with only one image of the chart.

Be warned: if you try this with "PrintPreview", it'll hang up the sheet to
the point that only killing it from taskman will get you out.

I can provide a sample if that helps, but there doesn't appear any place
to
put an attachment.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default print command from command button in userform causes double ch

If that were the case, it would show up whenever I did "print" or
"printpreview", right?

here's the code for the button on the spreadsheet that calls printpreview
itself

Private Sub CommandButton2_Click()
ActiveWorkbook.Sheets("Chart2").PrintPreview
End Sub

and here's the code that calls it from the command button on the userform:

Private Sub cbPrintIt_Click()
ActiveWorkbook.Sheets("Chart2").PrintPreview
End Sub

And that's all the code there is in the entire workbook.

Reproduce it yourself, you'll see.


"JLGWhiz" wrote:

It sounds like you have inadvertantly added a second chart to
Sheets("Chart2").



"Mike Jamesson" wrote in message
...
Excel 2007, SP2

I have an activex command button, "CommandButton1" on Sheet1, which issues
command "UserForm1.Show"; in Userform1 I have a command button, "PrintIt"
with the single line "ActiveWorkbook.Sheets("Chart2").PrintPreview" in the
_click event handler. (The same problem occurs with "printout", but this
way
I don't waste the paper.)

What happens is, I get the chart in the preview window, but it's as if
there
is a smaller version of the chart on top of a larger version. As I
indicated, if I use "...printout" instead of "...printpreview", it prints
this way, too, i.e., with "2 images" of the chart, a smaller superimposed
on
a larger.

The same line, "ActiveWorkbook.Sheets("Chart2").PrintPreview" (or
.PrintOut), when attached directly to a command button on the spreadsheet,
works as expected, with only one image of the chart.

Be warned: if you try this with "PrintPreview", it'll hang up the sheet to
the point that only killing it from taskman will get you out.

I can provide a sample if that helps, but there doesn't appear any place
to
put an attachment.




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default print command from command button in userform causes double chart

More info: In Excel 2007 I saved it as a 2003 xls, then opened it in xl2003;
it printed correctly from both the spreadsheet command button and the
userform command button.

"Mike Jamesson" wrote:

Excel 2007, SP2

I have an activex command button, "CommandButton1" on Sheet1, which issues
command "UserForm1.Show"; in Userform1 I have a command button, "PrintIt"
with the single line "ActiveWorkbook.Sheets("Chart2").PrintPreview" in the
_click event handler. (The same problem occurs with "printout", but this way
I don't waste the paper.)

What happens is, I get the chart in the preview window, but it's as if there
is a smaller version of the chart on top of a larger version. As I
indicated, if I use "...printout" instead of "...printpreview", it prints
this way, too, i.e., with "2 images" of the chart, a smaller superimposed on
a larger.

The same line, "ActiveWorkbook.Sheets("Chart2").PrintPreview" (or
.PrintOut), when attached directly to a command button on the spreadsheet,
works as expected, with only one image of the chart.

Be warned: if you try this with "PrintPreview", it'll hang up the sheet to
the point that only killing it from taskman will get you out.

I can provide a sample if that helps, but there doesn't appear any place to
put an attachment.

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 23
Default print command from command button in userform causes double ch

You can always try selecting the Sheet first:

Sheets("Chart2").Select
Activesheet.PrintOut

Maybe you also need to hide the UserForm first:

UserForm1.Hide





"Mike Jamesson" wrote:

More info: In Excel 2007 I saved it as a 2003 xls, then opened it in xl2003;
it printed correctly from both the spreadsheet command button and the
userform command button.

"Mike Jamesson" wrote:

Excel 2007, SP2

I have an activex command button, "CommandButton1" on Sheet1, which issues
command "UserForm1.Show"; in Userform1 I have a command button, "PrintIt"
with the single line "ActiveWorkbook.Sheets("Chart2").PrintPreview" in the
_click event handler. (The same problem occurs with "printout", but this way
I don't waste the paper.)

What happens is, I get the chart in the preview window, but it's as if there
is a smaller version of the chart on top of a larger version. As I
indicated, if I use "...printout" instead of "...printpreview", it prints
this way, too, i.e., with "2 images" of the chart, a smaller superimposed on
a larger.

The same line, "ActiveWorkbook.Sheets("Chart2").PrintPreview" (or
.PrintOut), when attached directly to a command button on the spreadsheet,
works as expected, with only one image of the chart.

Be warned: if you try this with "PrintPreview", it'll hang up the sheet to
the point that only killing it from taskman will get you out.

I can provide a sample if that helps, but there doesn't appear any place to
put an attachment.



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default print command from command button in userform causes double ch

Thanks! Selecting the chart sheet didn't help, but hiding the userform did!
I'd still say it's a bug, though, since this problem does not exist in 2003.

Thanks again.

"LOFE" wrote:

You can always try selecting the Sheet first:

Sheets("Chart2").Select
Activesheet.PrintOut

Maybe you also need to hide the UserForm first:

UserForm1.Hide





"Mike Jamesson" wrote:

More info: In Excel 2007 I saved it as a 2003 xls, then opened it in xl2003;
it printed correctly from both the spreadsheet command button and the
userform command button.

"Mike Jamesson" wrote:

Excel 2007, SP2

I have an activex command button, "CommandButton1" on Sheet1, which issues
command "UserForm1.Show"; in Userform1 I have a command button, "PrintIt"
with the single line "ActiveWorkbook.Sheets("Chart2").PrintPreview" in the
_click event handler. (The same problem occurs with "printout", but this way
I don't waste the paper.)

What happens is, I get the chart in the preview window, but it's as if there
is a smaller version of the chart on top of a larger version. As I
indicated, if I use "...printout" instead of "...printpreview", it prints
this way, too, i.e., with "2 images" of the chart, a smaller superimposed on
a larger.

The same line, "ActiveWorkbook.Sheets("Chart2").PrintPreview" (or
.PrintOut), when attached directly to a command button on the spreadsheet,
works as expected, with only one image of the chart.

Be warned: if you try this with "PrintPreview", it'll hang up the sheet to
the point that only killing it from taskman will get you out.

I can provide a sample if that helps, but there doesn't appear any place to
put an attachment.

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
Userform Command Button not available until another command buttonhas been used [email protected] Excel Programming 4 September 4th 08 04:35 PM
Use Command Button from each Row to fill UserForm RyanH Excel Programming 0 September 20th 07 01:24 PM
PRINT command button Jeff F Excel Programming 0 August 22nd 07 10:38 PM
command button print RKS Excel Discussion (Misc queries) 0 March 23rd 07 10:59 AM
need to minimize userform via command button on itself Jed[_3_] Excel Programming 1 August 10th 06 09:39 PM


All times are GMT +1. The time now is 10:26 PM.

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"