Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Programming / February 2007

Tip: Looking for answers? Try searching our database.

BeforePrint

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Robin Clay - 13 Feb 2007 12:40 GMT
Greetings !

Would anyone have some idea why this don't work - please ?

Private Sub App_WorkbookBeforePrint(ByVal Wb As Workbook, Cancel As Boolean)
   For Each wk In Wb.Worksheets
       If wk.Name = "DATA - ALL" Then
           Range("F12").ColumnWidth = 100
       End If
   Next
End Sub
Bob Phillips - 13 Feb 2007 13:03 GMT
Works for me. Did you setup application events correctly?

Signature

HTH

Bob Phillips

(there's no email, no snail mail, but somewhere should be gmail in my addy)

> Greetings !
>
[quoted text clipped - 7 lines]
>     Next
> End Sub
Robin Clay - 13 Feb 2007 13:43 GMT
...for which, muchos gracias.

> Works for me. Did you setup application events correctly?

Huh ?
Bob Phillips - 13 Feb 2007 14:22 GMT
For some reason you are using application events (see the App in the
procedure's signature).

From your response, you don't need them so use

Private Sub Workbook_BeforePrint(Cancel As Boolean)
   For Each wk In ThisWorkbook.Worksheets
       If wk.Name = "DATA - ALL" Then
           wk.Range("F12").ColumnWidth = 100
       End If
   Next
End Sub

Signature

HTH

Bob Phillips

(there's no email, no snail mail, but somewhere should be gmail in my addy)

> ...for which, muchos gracias.
>
> > Works for me. Did you setup application events correctly?
>
> Huh ?
Robin Clay - 13 Feb 2007 15:47 GMT
> From your response, you don't need them so use

Thank you !
Tom Ogilvy - 13 Feb 2007 14:30 GMT
Use the Workbook level BeforePrint

In the ThisWorkbook Module:

Private Sub Workbook_BeforePrint(Cancel As Boolean)
   Dim wk as Worksheet
   For Each wk In ThisWorkbook.Worksheets
       If wk.Name = "DATA - ALL" Then
           wk.Range("F12").ColumnWidth = 100
       End If
   Next
End Sub

Unless you really want this to be an application level event.  Then you need
to instantiate application level events

http://www.cpearson.com/excel/appevent.htm

Signature

Regards,
Tom Ogilvy

> ...for which, muchos gracias.
>
>> Works for me. Did you setup application events correctly?
>
> Huh ?
Robin Clay - 13 Feb 2007 15:48 GMT
> Use the Workbook level BeforePrint

Thank you !
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.