Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 247
Default printing macro,want to use beforeprint event?

below is a macro I have written/recorded.My macro skills are pretty basic(no
pun intended!)I always start with a recorded procedure and go on from there.
The idea of this prcedure is two fold.
1) print only the worksheets used
2) check that freight has been allowed on each sheet(product type)
3)I am aware that I have not "dim" at the start but i dont undersand that
stuff
In my mind this could be activated by the before print event but i notice
that the before print event is triggered evrytime the .printout call is made
How should i call it,just a button on the sheet or toolbar?
4)At the moment it just lives in a general module of the quote template but
i dont really want it in every quote i do.
Sub Macro1()
'
' Macro1 Macro
' Macro recorded 26/06/2006 by paul
'

ScreenUpdating = False
If Range("framefreight") = 0 And Range("framesell") 0 Then
myfrfreight = InputBox("Enter Freight for frames in hrs then ok to
continue or cancel to exit.Enter 0 to enter no freight or cancel to exit to
workbook", "Freight", 2)
If myfrfreight = "" Then
Exit Sub
Else
Range("framefreight") = myfrfreight
End If
End If
If Range("trussfreight") = 0 And Range("trusssell") 0 Then
mytrfreight = InputBox("Enter Freight for trusses in hrs then ok to
continue or cancel to exit.Enter 0 to enter no freight or cancel to exit to
workbook", "Freight", 2)
If mytrfreight = "" Then
Exit Sub
Else
Range("trussfreight") = mytrfreight
End If
End If
If Range("posifreight") = 0 And Range("posisell") 0 Then
mypofreight = InputBox("Enter Freight for frames in hrs then ok to
continue or cancel to exit.Enter 0 to enter no freight or cancel to exit to
workbook", "Freight", 2)
If mypofreight = "" Then
Exit Sub
Else
Range("posifreight") = mypofreight
End If
End If
If Range("rafterfreight") = 0 And Range("raftersell") 0 Then
myrafreight = InputBox("Enter Freight for frames in hrs then ok to
continue or cancel to exit.Enter 0 to enter no freight or cancel to exit to
workbook", "Freight", 2)
If myrafreight = "" Then
Exit Sub
Else
Range("rafterfreight") = myrafreight
End If
End If
Sheets("Cover").Select
Application.Dialogs(xlDialogPrint).Show
If Range("framesell") 0 Then
Sheets("Frame").PrintOut Copies:=1
End If
If Range("trusssell") 0 Then
Sheets("Truss").PrintOut Copies:=1
Sheets("Truss Materials").PrintOut Copies:=1
End If
If Range("posisell") 0 Then
Sheets("posi").PrintOut Copies:=1
End If
If Range("raftersell") 0 Then
Sheets("Rafter").PrintOut Copies:=1
End If
If Range("mismattot") 0 Then
Sheets("mismat").PrintOut Copies:=1
End If
ScreenUpdating = True
End Sub

--
paul

remove nospam for email addy!

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default printing macro,want to use beforeprint event?


paul Wrote:
1) print only the worksheets used

You could do something like this...

Sheets("Select").Select
If ActiveSheet.Range("F5").Value < 1 Then
Sheets("two").Select
ActiveWindow.SelectedSheets.Visible = False
End If
'Print three
Sheets("Select").Select
If ActiveSheet.Range("F6").Value < 1 Then
Sheets("three").Select
ActiveWindow.SelectedSheets.Visible = False
End If

in this example...
if Sheet"Select"range F5 is less then 1 then Hide sheet "two"
if Sheet"Select"range F6 is less then 1 then Hide sheet "three"
then in your macro you could have print entire workbook and only the
sheets that are visible will be printed
in the same macro after the print command you should make sheets
visible again

Sheets("two").Visible = True
Sheets("three").Visible = True


--
davesexcel


------------------------------------------------------------------------
davesexcel's Profile: http://www.excelforum.com/member.php...o&userid=31708
View this thread: http://www.excelforum.com/showthread...hreadid=557643

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
BeforePrint macro difficulties SchneidRL Excel Programming 3 January 13th 06 08:52 PM
Execute code after printing with the BeforePrint event mikeburg[_38_] Excel Programming 1 October 2nd 05 06:27 AM
BeforePrint macro Steve O Excel Discussion (Misc queries) 4 September 21st 05 01:09 AM
BeforePrint Event Woody[_4_] Excel Programming 2 July 20th 05 09:48 AM
BeforePrint event EnglishTeacher Excel Programming 4 October 13th 04 04:17 PM


All times are GMT +1. The time now is 01:57 AM.

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

About Us

"It's about Microsoft Excel"