Macro to print


Posted by Brad on January 24, 2002 2:14 PM

I posted this a few days ago but no one understood what I wanted exactly. I need a macro that will print the page it's situated on. Not actually print it though: just bring up the print options screen (ctrl+p). I can't do this with the macro wizard because it won't let you stop recording while the print options screen is up. Hope I have explained this properly and thanks for any help in advance.

Posted by Mark O'Brien on January 24, 2002 3:47 PM

I think this is what you want:

Application.Dialogs(xlDialogPrint).Show

This throws up the same dialogue box as [CTRL] + "P".

HTH

Posted by Brad on January 24, 2002 4:15 PM

Thanks a lot.
That's exactly what I was looking for. I can't thank you enough. Just out of interest, how do you work out a code like that (is it just knowledge)?



Posted by Mark O'Brien on January 24, 2002 4:53 PM

I worked that one because someone asked a question on here today about the "Open" dialogue box. I then did a bit of experimentation on your problem. So in this case, I learned from here. Usually a good source of help is the VBA help provided with Excel (although you usually have to a "Custom" installation to get this help file). Another source is the internet. Just go to google or whatever and usually you can get a good code example, just make sure you put "VBA" in the search criteria. And the last good source is this message board, over time, just by reading other people's problems you learn a little more.