Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default VBA Problem - Print Preview

Is it possible for excel to run a macro whebn i close Print Preview?

A macro runs to go to print preview to modify row height to fi
contents to page and I want to excel to run amacro to return them t
original size when i close the print preview!

Is this possible to do?

Any help would be useful!

Thanks

Carl Jone

--
Message posted from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default VBA Problem - Print Preview

Carl,

You can't do it for Print Preview exclusively. You can use the
BeforePrint event of the Workbook, but this executes for both
printing and print preview. Sadly, there is no AfterPrint
event, so you can't restore the settings you change in
BeforePrint. Put the following code in the ThisWorkbook code
module.

Private Sub Workbook_BeforePrint(Cancel As Boolean)
' your code here
End Sub



--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"carljonesuk " wrote
in message ...
Is it possible for excel to run a macro whebn i close Print

Preview?

A macro runs to go to print preview to modify row height to fit
contents to page and I want to excel to run amacro to return

them to
original size when i close the print preview!

Is this possible to do?

Any help would be useful!

Thanks

Carl Jones


---
Message posted from http://www.ExcelForum.com/



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Page Preview/Print Problem [email protected] New Users to Excel 3 December 31st 09 05:39 PM
Print Preview Problem in Excel Alex Excel Discussion (Misc queries) 1 August 19th 08 01:23 PM
print/preview problem before saving an edited excel worksheet SS Excel Discussion (Misc queries) 1 July 24th 08 12:00 PM
Problem w/Print Preview since upgrade to office 2003 Meenie Excel Discussion (Misc queries) 2 May 24th 07 06:16 PM
print preview v page break preview SamB Excel Discussion (Misc queries) 0 November 16th 06 05:09 PM


All times are GMT +1. The time now is 02:19 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"