Excel 2007 Print Preview button disabled

C

Corey

I have code to input data into a sheet, then Print Preview the shet for the USER to either view as
is, or Print.
Problem is Excel 2007 Print Preview button to PRINT the sheet is DISABLED.

How can i enable the Print Button?


Corey....
 
C

Corey

Dave, It seems to be disabled for ONLY the Excel Application working on.
If a blank sheet is created and 1 value placed in the sheet, Print Preview used, then the option to
Print is enabled.
But not when run from the code.

The line of VBA i use is :
ActiveWindow.SelectedSheets.PrintPreview

Any idea's?


It's not disabled for me.

Is it disabled for all workbooks for you?
 
D

Dave Peterson

I ran the same line from code and the print button was enabled.

Did you try that same line of code on a new worksheet in a new workbook?

I don't really have a guess. I know that the ribbom can be customized, but I'm
not sure how (or if) the print preview ribbon can be changed.
 
J

Jim Rech

I don't understand why the Print button is disabled either but does this
code do the same thing?

ActiveSheet.PrintOut Preview:=True

--
Jim
| Dave, It seems to be disabled for ONLY the Excel Application working on.
| If a blank sheet is created and 1 value placed in the sheet, Print Preview
used, then the option to
| Print is enabled.
| But not when run from the code.
|
| The line of VBA i use is :
| ActiveWindow.SelectedSheets.PrintPreview
|
| Any idea's?
|
|
| | It's not disabled for me.
|
| Is it disabled for all workbooks for you?
|
| Corey wrote:
| >
| > I have code to input data into a sheet, then Print Preview the shet for
the USER to either view as
| > is, or Print.
| > Problem is Excel 2007 Print Preview button to PRINT the sheet is
DISABLED.
| >
| > How can i enable the Print Button?
| >
| > Corey....
|
| --
|
| Dave Peterson
|
|
 
Joined
Feb 13, 2008
Messages
1
Reaction score
0
I'm having the same problem... admittedly I'm new to VBA and Excel programming but I have a hunch... my code calls the print preview in the middle of a bunch of other stuff. Is the fact that the code isn't at a breakpoint possible behind causing the ribbon to be disabled? In case that was less clear when I typed it than it was in my head here's how my program works:

I have a modal form that loads when the excel file loads. From the form the user clicks check boxes to select different actions (like prepare a report sorted by last name, prepare a report sorted by id number, email a copy of the report, etc.) and then clicks a run button. The run button brings up an open dialog and asks the user to browse to a text document that contians raw data.

When the user finds the file and clicks open, the system imports the data from the text file, cleans out anything the user wouldn't want (page numbers and weird headers and footers and such), and then does whatever the user asked it to do on that form. If the user requests a print out of a report, the system opens a print preview of the report and then waits for the user to close the print preview before moving on to the next task (which may be to open some other report in print preview or to export and email or to just return to the form and stop). In 2003 and previous versions of office, this code has no problem but in 2007 it chokes at the preview and locks out the buttons on the ribbon.

If my hunch is right, can I somehow tell excel to suspend the macro until the user prints or closes and then have it resume after? Will that solve the problem? Thanks for the help!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top