Results 1 to 2 of 2

Thread: Batch Plotting /w Restrictions

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Oct 1999
    Location
    Nashville, TN
    Posts
    114

    Post

    I am still very new to VB so sometimes the simple things don't make since.
    I want my program to loop though my settings (all option buttons with the print dialog control), then print the files that I have in a listbox (List1.ListIndex).

    1) I do I set up the loop event?
    2) Can I or how do I clean up my option button code to be more efficient?

    This is what I have (minus the stuff that didn't work.

    Dim swApp As Object
    Dim Part As Object

    ' defined in swa.bas
    Const vbPRORPortrait = 1
    Const vbPRORLandscape = 2

    ' defined in swa.bas
    Const swPrintPaperSize = 0
    Const swPrintOrientation = 1

    Private Sub cmdPrinterSetup_Click()

    'enable the error handler on cancel.
    CommonDialog1.CancelError = True
    On Error GoTo CancelPrintSetup

    'Display the Print dialog box.
    CommonDialog1.ShowPrinter

    'Get the desired values from the Print
    'dialog box
    Printer.PaperSize = 256
    Printer.Orientation = CommonDialog1.Orientation
    Exit Sub

    CancelPrintSetup:
    'display a message on cancel.
    MsgBox ("Printer setup canceled"), , "Batch Print"

    End Sub

    Private Sub Command1_Click()
    Form1.Show
    Form3.Hide
    End Sub

    Private Sub Command2_Click()
    Set swApp = CreateObject("SldWorks.Application")
    Set Part = swApp.ActiveDoc


    If Option2.Value = True Then
    Part.PrintSetup(swPrintOrientation) = vbPRORLandscape
    Else
    Option1.Value = False
    End If

    If Option1.Value = True Then
    Part.PrintSetup(swPrintOrientation) = vbPRORPortrait
    Else
    Option2.Value = False
    End If

    If Option3.Value = True Then
    Part.PaperSize(swPrintPaperSize) = vbPRPSLetter
    Else
    Option4.Value = False
    Option5.Value = False
    Option6.Value = False
    Option7.Value = False
    End If

    If Option4.Value = True Then
    Part.PaperSize(swPrintPaperSize) = vbPRPSTabloid
    Else
    Option3.Value = False
    Option5.Value = False
    Option6.Value = False
    Option7.Value = False
    End If

    If Option5.Value = True Then
    Part.PaperSize(swPrintPaperSize) = vbPRPSCSheet
    Else
    Option3.Value = False
    Option4.Value = False
    Option6.Value = False
    Option7.Value = False
    End If

    If Option6.Value = True Then
    Part.PaperSize(swPrintPaperSize) = vbPRPSDSheet
    Else
    Option3.Value = False
    Option4.Value = False
    Option5.Value = False
    Option7.Value = False
    End If

    If Option7.Value = True Then
    Part.PaperSize(swPrintPaperSize) = vbPRPSESheet
    Else
    Option3.Value = False
    Option4.Value = False
    Option5.Value = False
    Option6.Value = False
    End If

    swApp.ActivePrinter = Printer



    End Sub

  2. #2

    Thread Starter
    Lively Member
    Join Date
    Oct 1999
    Location
    Nashville, TN
    Posts
    114

    Post

    I need to append my request!

    On form1 is my listbox2 containin the files I want to process. After loading the files into the listbox I have a print setup button that opens form3, that is where the code from above is. From this form (form3), after I have choosen my paper orientation, size and print (from common dialog box) I want to begin the printing.

    Who do I tell my print command button (form3) to select the files on form1?

    Mike


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width