Excel Vba Print Preview S’abonner

0
Avatar
Legacy Poster

I have Excel VBA code that pulls up a Bartender program (file) depending on what the user inputs into the user form. 

 

What I am having trouble with is I am trying to use Excel VBA to show a print preview of the label before it is printed automatically.  I have enabled Bartender 8.1 under my References so I see some of the supported codes but I cannot seem to find one or get it to print preview.

 

Any suggestions?

5 commentaires

0
Avatar
Shotaro Ito
Actions pour les commentaires Permalien

Do you use BarTender 8.01?

Exporting print preview from ActiveX is supported from BarTender 9.0, so at that time export preview was not available.

Consider upgrade to the latest BarTender's Enterprise Automation Edition.

(note Automation edition doesn't support exporting preview.)

 

This topic might helps:

http://forums.seagullscientific.com/index.php?/topic/781-activex-print-preview/

0
Avatar
Legacy Poster
Actions pour les commentaires Permalien

I guess instead of getting Bartender to open or export a preview of the image, I was seeing if I could get the Excel VBA code to send over a command to execute print preview command or hot keys in the application itself.  We do not need to print out or save the preview as a image.  We just need to check/verify the serial number that is pulled from an external database before printing.

0
Avatar
Shotaro Ito
Actions pour les commentaires Permalien

There's no command line option or ActiveX method to show preview window directly - you can show print dialog by /PD command line option, though.

in VBA code..

Set objShell = CreateObject("WScript.Shell")
objShell.Run """<your bartend.exe's path>\bartend.exe"" /AF=""C:\test.btw"" /PD /X"
0
Avatar
Legacy Poster
Actions pour les commentaires Permalien

In the end, my manager bought Bartender 9.01 build 2524: International,Professional  and not the 10.0 Enterprise.

I executed the code you gave me and method Run failed of object IWshShell3 . Is there any correction i should make with this code so it is acceptable by 9.01?

 

Thanks - Art

0
Avatar
Shotaro Ito
Actions pour les commentaires Permalien

Unfortunately, Professional edition doesn't support Automation / Command line printing.

 

In BarTender 10.1 Automation, you can show print preview dialog from ActiveX code - see below sample (C#).

// Declare a BarTender application variable  

BarTender.Application btApp; 



// Declare a BarTender document variable  

BarTender.Format btFormat; 



// Create a new instance of BarTender  

btApp = new BarTender.Application();



// Set the BarTender dialogs visible 

btApp.VisibleWindows = BarTender.BtVisibleWindows.btInteractiveDialogs;



// Open a BarTender document 

btFormat = btApp.Formats.Open("c:\\Format1.btw", false, "");



// Show the preview window 

btFormat.PrintPreview.Show();



// Close the preview window 

btFormat.PrintPreview.Close();



// End the BarTender process  

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges); 

Vous devez vous connecter pour laisser un commentaire.