Link to home
Start Free TrialLog in
Avatar of varvoura
varvoura

asked on

Prompt with a Page Setup and print dialogbox before printing an Excel sheet using Lotusscript

Hi all,

I am creating a excel object using lotusscript/vb code.

...
...
Set excelobject = CreateObject("Excel.Application")

I have the following command to send the excel directly to printer

excelobject.worksheets(1).PrintOut     - This works well and sends the file directly to printer

Now, I need to invoke a command so that the "Page Setup/Printer Dialogbox" opens to the user so they can make whatever selection they require then send it to printer

I have tried:

commonDialog1.ShowPrinter instead of the print command - This didn't work.

I don't want to use

With excelobject.worksheets(1).PageSetup


Any ideas on how to achieve this will be appreciated.

Thanks,
varvoura

Avatar of Chris Bottomley
Chris Bottomley
Flag of United Kingdom of Great Britain and Northern Ireland image

To use the printer setup dialog, you need an open workbook and the app needs to be visible otherwise you are stuck ... see below as an example
Chris
Const xlDialogPrinterSetup As Integer = 9
Set excelobject = CreateObject("Excel.Application")
excelobject.Visible = True
excelobject.workbooks.Open ("C:\Users\me\fred.xls")
excelobject.Dialogs(xlDialogPrinterSetup).Show

Open in new window

Avatar of varvoura
varvoura

ASKER

Chris,

Thanks a million.

I'll take that solution. If users not happy they can keep my original option.

ASKER CERTIFIED SOLUTION
Avatar of Chris Bottomley
Chris Bottomley
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial