Vba Printing With If Statement Follow

0
Avatar
Legacy Poster

Hello.

 

I am trying to automate the closing of Bartender with Excel VBA code.  Basically, if the operator presses the "Print" button on the print dialoug screen, I was the program to close.  But I want the operator to pull the print dialoug screen up them selves and the VBA code wait on the operator's input.  This is what I have so far:

 

 

 

Public Sub test()

 

Dim btApp As BarTender.Application
Dim btFormat As BarTender.Format

 

Set btApp = New BarTender.Application
Set btFormat = New BarTender.Format

 

btApp.Formats.Open ("K:\EpilogLaser\Program Draft folder - UNRELEASED\351000 KIT.btw")

 

btApp.Visible = True

 

btApp.ActiveFormat.IdenticalCopiesOfLabel = 1

 

If btFormats = btApp.ActiveFormat.PrintOut(True, Flase) = True Then
    btApp.Quit (btDoNotSaveChanges)
Else
    Msg "Program not sent to Epilog Laser Marker"
End If

 

 

 

It almost works except that this code automatically brings the print dialoug screen up.  Any suggestions?

3 comments

0
Avatar
Shotaro Ito
Comment actions Permalink

 
I am trying to automate the closing of Bartender with Excel VBA code.  Basically, if the operator presses the "Print" button on the print dialoug screen, I was the program to close.  But I want the operator to pull the print dialoug screen up them selves and the VBA code wait on the operator's input. 

 

 

Hi,

Void Format.PrintOut(<show progress dialog>,<show print dialog>) 

Print out doesn't return value, so you cannot use that in IF condition.

If you want to pick error, then use Format.Print().

 

When you want to show print dialog and quit BarTender after print, that would be

btApp.VisibleWindows = btInteractiveDialogs
btApp.ActiveFormat.PrintOut(True, True)
btApp.Quit (btDoNotSaveChanges)
0
Avatar
Legacy Poster
Comment actions Permalink

If the Print out does not return a value, then I am not sure if I can do what I want to do. 

 

Basically,

 

When print button is pressed, then close.  I don't want the print dialog to show up automatically because the operator views the print preview first.  Only if the print button is pressed, then close the program.

0
Avatar
Shotaro Ito
Comment actions Permalink

btApp.ActiveFormat.PrintOut(True, False)
btApp.Quit(btDoNotSaveChanges)

above would not show print dialog, just print. (in your code, "False" spelled wrong)

Please sign in to leave a comment.