Print From Vba Follow

0
Avatar
Legacy Poster

I want to update a text box in Bartender from excel.  The textbox has a shared name of "Part".  I'm running this code from vba in excel:

 

btFormat.SetNamedSubStringValue "part", "5"

 

I get an error saying that "part" is not a named data source.  

 

Help...

10 comments

0
Avatar
Ian Cummings
Moderator
Comment actions Permalink

Did you set the name of the data source itself, or the name of the label object?  It needs to be a name of the data source, which by default is blank.

0
Avatar
Legacy Poster
Comment actions Permalink

In the Text Properties under the Data Source tab, I changed the "Name:" Field to "Part".  The type is Embedded Data.  I'm getting the same error today.

0
Avatar
Ian Cummings
Moderator
Comment actions Permalink

Have you tried using parenthesis?

 

btFormat.SetNamedSubStringValue("Part", "5")

 

In fault finding, use the GetSubString() call to iterate through all sub-strings in the document.  I guess this will help to uncover where you're going wrong.

 

'Select the data source

btSubString = btFormat.NamedSubStrings.GetSubString(1)

 

'Show the data source's name

MessageBox.Show(btSubString.Name)

0
Avatar
Legacy Poster
Comment actions Permalink

If I use the parenthesis I get:

 

Compile Error:

Expected: =

 

I tried the code you suggested.

 

I get this:

 

The named data source 1 is not found in the named data source list.

0
Avatar
Ian Cummings
Moderator
Comment actions Permalink

I suggest you attach your BarTender document and paste in the relevant section of code for us to take a look at.

0
Avatar
Legacy Poster
Comment actions Permalink

Sub test()
 
Dim btApp As BarTender.Application
Dim btFormat As BarTender.Format
Dim btSubString As BarTender.SubString
 
 
 
    Set btApp = New BarTender.Application
    Set btFormat = New BarTender.Format
    btApp.Formats.Open ("f:\labels\new breakout tags\breakouts.btw")
    btApp.Visible = True
    
    'Select the data source
btSubString = btFormat.NamedSubStrings.GetSubString(1)
 
'Show the data source's name
MessageBox.Show (btSubString.Name)
End Sub
--------------------------------------------------------------------------------------------------------
Here is the actual section of bartender code I'm working on:
 
Sub macro_breakoutlabel()
'-4/1/15 Change from commander to direct from excel.  Brandon Hurst
 
 
 
Dim btApp As BarTender.Application
Dim btFormat As BarTender.Format
    
 
 
'Open Bartender and Print
 
    Set btApp = New BarTender.Application
    Set btFormat = New BarTender.Format
    btApp.Formats.Open ("f:\labels\new breakout tags\breakouts.btw")
    btApp.Visible = True
    
   
   btFormat.SetNamedSubStringValue "Part", "7"
 
   ' btApp.ActiveFormat.IdenticalCopiesOfLabel = 1
    btFormats = btApp.ActiveFormat.PrintOut(False, False)
 
 
 
 
 
 
End Sub
 
0
Avatar
Legacy Poster
Comment actions Permalink

I tried changing the field to a globalitem.  I'm able to update the field, however, Bartender freezes while trying to print.

0
Avatar
Legacy Poster
Comment actions Permalink

For anyone who may read this, since Bartender never gave me an answer, here is what I found finally worked:

 

 

Set btApp = New BarTender.Application
     Set btFormat = btApp.Formats.Open("c:\bartenderfile.btw")
     btApp.Visible = False
     btFormat.SetNamedSubStringValue "Part", Filename
   
  Filename is a variable declared earlier in my code.
0
Avatar
Nishan Amarasingha
Comment actions Permalink

Dera All we have display to below error "Run-time Error '429': ActiveX Component cant't create Object" please help to clear about matter ...

 

Object code

Set btApp = New BarTender.Application

0
Avatar
Ian Cummings
Moderator
Comment actions Permalink

Could be any one of a number of different causes, such as BarTender not being installed, activated, or of a sufficient edition to support automation.  There are other possibilities also.

Please sign in to leave a comment.