Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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! |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
BeforePrint macro difficulties | Excel Programming | |||
Execute code after printing with the BeforePrint event | Excel Programming | |||
BeforePrint macro | Excel Discussion (Misc queries) | |||
BeforePrint Event | Excel Programming | |||
BeforePrint event | Excel Programming |