Help With Print Preview

R

Reginald Johnson

Hello,
I have an Access Form with a Tab Control in it. On one of the Tab
controls I have a MS Spreadsheet Control. I've worked through the
problems I've had so far, and the worksheet works as I want it to.
However, I am unable to Print Preview it. As of now, my code looks like
this:

Public Function FuncPrintPreview (frmMe as Form)

Dim wrkSheet as WorkSheet
Set wrkSheet =frmMe.SprdTracker.ActiveSheet
wrkSheet.Range("A1:N14").PrintPreview

End Function

However, it doesn't look like Print Preview is a method of any sort that
is associated with a worksheet object. Does anybody have an idea on
how to do this?
 
P

Peter

Do you have to preview only that range?

PrintPreview applies to the Worksheet object, at least in Office 2002, so wrkSheet.PrintPreview should preview the whole sheet..

hth,

-Peter
 
R

Reginald Johnson

Peter,
Thanks for the quick response. This problem has me tearing my hair out.

Trying "wrkSheet.PrintPreview" gives me an:
"Object doesn't support this property or method" error.

I've also tried adding a spreadsheet control to a report since reports
have a built in print preview capability, but I am unable to get access
to the control with the following code:

Dim rptTracker As Report, sprdTracker As Spreadsheet, wrkSheet As WorkSheet

Set rptTracker = Application.Reports("TrackerReport")
Set sprdTracker =rptTracker.Controls("sprdReportTracker")
Set wrkSheet = sprdTracker.ActiveSheet

however I get a "Compile error: Invaid use of property" for "sprdTracker ="
 
J

Jim Cone

Reginald,
All I know about spreadsheet controls is what you wrote in your posts,
but being unafraid to embarrass myself....

Are you sure that spreadsheet control has any relationship to Excel?
It sounds like to me that it is some kind of active x control and not a real Excel workbook/worksheet.
That said, try declaring the wrkSheet as an "Object".
Then try setting it to something that Access will recognize like?...
MyForm.SpreadsheetControl(1)

Regards,
Jim Cone
San Francisco, CA
 
R

Reginald Johnson

Honestly, I'm not totally sure it does have a relationship with Excel.
the actual object name is "Microsoft Office Spreadsheet 9.0".
After more Googling, I've added the "Microsoft Visual Basic for
Applications Extensiblity 5.3", and "Microsoft Excel 9.0 Object Library"
which has given me access to the "Excel.Application" objects which
have "PrintOut" and "PrintPreview" as methods. However, I cannot find a
way to set the "Microsoft Office Spreadsheet 9.0" to an Excel.Workbook
or Excel.Spreadsheet.
 
J

Jim Cone

Reginald,

I added the Microsoft Office Spreadsheet 10.0 to an Excel userform.
The help button on the "spreadsheet" displayed the following subject re printing...
'----------------------------------------------------------------------------
"Print a spreadsheet
To print a spreadsheet from the browser, you must print the entire Web page.

In Microsoft Internet Explorer, click Print on the File menu.
Note If the spreadsheet is wider or longer than the printed page,
the areas that don't fit on the page are not printed.
For more control over how the data is printed, including the ability to print
a long list and set page breaks, you can export the spreadsheet to Microsoft Excel
by clicking Export to Microsoft Excel on the toolbar.
For information about printing from Excel, see Excel Help. "
'----------------------------------------------------------

Also, I found no "Print" or "PrintPreview" properties for the "spreadsheet".
Also, there is no Worksheet property, just a Workbooks and a Worksheets property and
there is, again, no print property for them.

Regards,
Jim Cone
San Francisco, CA

Reginald Johnson said:
Honestly, I'm not totally sure it does have a relationship with Excel.
the actual object name is "Microsoft Office Spreadsheet 9.0".
After more Googling, I've added the "Microsoft Visual Basic for
Applications Extensiblity 5.3", and "Microsoft Excel 9.0 Object Library"
which has given me access to the "Excel.Application" objects which
have "PrintOut" and "PrintPreview" as methods. However, I cannot find a
way to set the "Microsoft Office Spreadsheet 9.0" to an Excel.Workbook
or Excel.Spreadsheet.
- snip -
 
R

Reginald Johnson

Jim,
I'm starting to see where my disconnect is. The Spreadsheet control
I'm using is an Office Web Contol and not an Excel spreadsheet as far as
the methods in VBA are concerned.
Frankly, all I want is a grid that will allow me to present the data
from my database, while letting me color individual cell backgrounds to
draw the user's attention. The OWC Spreadsheet I'm using allows me to
do that, but not print. In order to print I have to export then open
the sheet in Excel which takes the user out of the "safe and cozy"
environment I was hoping to create. Once I pull up the Print Preview in
Excel, they are presented with other commands from the Print Preview
page that don't take them back to my application.
If anybody knows of a free grid control that will allow me to do this
I'd be very greatful if they'd point me to it.
 

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