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.


Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Chris BottomleySoftware Quality Lead EngineerCommented:
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
Const xlDialogPrinterSetup As Integer = 9
Set excelobject = CreateObject("Excel.Application")
excelobject.Visible = True
excelobject.workbooks.Open ("C:\Users\me\fred.xls")

Open in new window

varvouraAuthor Commented:

Thanks a million.

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

Chris BottomleySoftware Quality Lead EngineerCommented:
If that is it ... please close the question and assign the solution otherwise what else is needed?


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Lotus IBM

From novice to tech pro — start learning today.