MartyConnelly
martyconnelly at shaw.ca
Tue Aug 8 10:28:13 CDT 2006
Well it is either returning a TypeDef or an Object Without access to the olb or dll file, kinda of hard to tell. If it is an object this should work. Dim BtFormat as Object Set BtFormat = BtApp.Formats.Open(Me.fldFABLabelFile) Rocky Smolin - Beach Access Software wrote: >Marty: > >No Soap. It didn't like Format. > >I'm thinking now that I could use early binding, test for the reference, >delete it if its missing, and gray out the button on the main menu which >runs the bar code printing form. Would that be simpler? > >Rocky > > >MartyConnelly wrote: > > >>Just a guess but could be a TypeDef called Format >>Ugh, I wouldn't have used a reserved word for a TypeDef name. >>Don't know what the dll was written in. However >> >>Might look like this, so just add this type to beginning of your module >>or however it's defined in the OB >> >>Type Format >> i As Long >> str As String >>End Type >> >>Then in your calling routine >>dim btFormat as Format >> >> In the browser select Bartender library then look >>for a Public Type Format , the individual variables >>will be in the right pane >> >> >>Rocky Smolin - Beach Access Software wrote: >> >> >> >> >>>Marty: >>> >>>Here's what it says: >>> >>>Function Open(FileName As String, [CloseOutFirstFormat As Boolean = >>>False], [UsePrinter As String]) As Format >>> Member of BarTender.Formats >>> Opens an existing format file. >>> >>>'as Format' doesn't make sense though, does it? >>> >>>Rocky >>> >>> >>>MartyConnelly wrote: >>> >>> >>> >>> >>> >>>>Under the library selection pane of OB, when you open the library the >>>>two lower panes >>>>the left most has the members, It will say somethinglike classes, >>>>select the one >>>>you want and its members are displayed in the right pane, left click on >>>>the one >>>>you want to see in right pane and its calling parameters input and ouput >>>>will be displayed in >>>>lowest pane along with datatypes. You also may have to right click and >>>>select hidden members. >>>> >>>> >>>>Rocky Smolin - Beach Access Software wrote: >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>>>It says Formats is a member of Bar Tender. and Open is a member of >>>>>Formats. Where do I see the data type being returned? >>>>> >>>>>T&R >>>>> >>>>>Rocky >>>>> >>>>> >>>>>MartyConnelly wrote: >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>>>Err the Object Browser should tell you the data type being returned. >>>>>>if you have the reference set. >>>>>> >>>>>>MartyConnelly wrote: >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>>>If you are setting it, you must be returning an object rather than a >>>>>>>variant. >>>>>>>Set a reference to bartender and look at the values in the Object Browser >>>>>>>libary for Bartender to see what they should be set to. >>>>>>> >>>>>>>Rocky Smolin - Beach Access Software wrote: >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>>>Marty: >>>>>>>> >>>>>>>>I deleted the Reference to Bartender and changed the declarations to: >>>>>>>> >>>>>>>>Public BtApp As Object 'BarTender.Application >>>>>>>>Public BtFormat As Variant 'BarTender.Format >>>>>>>> >>>>>>>>In the load event I put: >>>>>>>> >>>>>>>>Set BtApp = CreateObject("BarTender.Application") >>>>>>>>In the Print event however, on the line >>>>>>>> >>>>>>>>Set BtFormat = BtApp.Formats.Open(Me.fldFABLabelFile) >>>>>>>> >>>>>>>>I get an 'argument not optional' error. With the old declarations it >>>>>>>>worked. Any idea what's going wrong? >>>>>>>> >>>>>>>>Thanks and regards, >>>>>>>> >>>>>>>>Rocky >>>>>>>> >>>>>>>> >>>>>>>>MartyConnelly wrote: >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>>>You are mixing Early and Late Binding methods >>>>>>>>>First remove the reference >>>>>>>>>Then just change your declarations to things like >>>>>>>>> >>>>>>>>>Public BtApp As Object 'BarTender.Application >>>>>>>>>Public BtFormat As String 'BarTender.Format >>>>>>>>> >>>>>>>>> >>>>>>>>>If you are unsure of the type returned try using a variant >>>>>>>>>especially in the case of returned arrays. >>>>>>>>> >>>>>>>>>or leave both types in and do a conditional compile around them >>>>>>>>> >>>>>>>>>#Const DebugVersion = 0 >>>>>>>>> >>>>>>>>>#if DebugVersion = 1 then >>>>>>>>>Dim wa as BarTender.Application >>>>>>>>>Set wa = new BarTender.Application >>>>>>>>>#else >>>>>>>>>Dim wa as Object >>>>>>>>>set wa = createobject ("BarTender.Application") >>>>>>>>>#endif >>>>>>>>>You'l have to set the flag to 1 >>>>>>>>>(#Const DebugVersion = 1) >>>>>>>>>and then add a reference to Bartender >>>>>>>>>for the debug intellisence to work.. >>>>>>>>> >>>>>>>>>Then to check if Bartender is actually installed on the machine >>>>>>>>> >>>>>>>>>On Error Resume Next >>>>>>>>>Set objExcelapp = CreateObject("BarTender.Application") >>>>>>>>>If Err.Number Then >>>>>>>>> MsgBox "Bartender not installed or not registered for Automation" >>>>>>>>> Exit Sub >>>>>>>>>End If >>>>>>>>>'reset error >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>>Rocky Smolin - Beach Access Software wrote: >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>>>Dear List: >>>>>>>>>> >>>>>>>>>>I have a client who prints bar coded labels through an application >>>>>>>>>>called Bartender (cute, huh?). I wrote a production management system >>>>>>>>>>for them which contains all the information in the db that they are >>>>>>>>>>inputting manually into Bartender. So the client asked me to add a >>>>>>>>>>function to the app to run Bartender from the production system and that >>>>>>>>>>is working great. >>>>>>>>>> >>>>>>>>>>To do this I downloaded and installed the trial version of Bartender and >>>>>>>>>>so was able to set a reference to it in the VBA code so I could run >>>>>>>>>>Bartender from the client's app (stuff like Public BtApp As >>>>>>>>>>BarTender.Application and Public BtFormat As BarTender.Format and Set >>>>>>>>>>BtApp = CreateObject("BarTender.Application")). >>>>>>>>>> >>>>>>>>>>Problem is that the app won't run on any machine which doesn't have >>>>>>>>>>Bartender loaded - it gets a broken reference error when the app opens. >>>>>>>>>> >>>>>>>>>>So I'm wondering how to handle this. Perhaps I unset the reference in >>>>>>>>>>the Tools-->References and set it when the bar code form opens? Or is >>>>>>>>>>there a way to trap and get around this error when the app loads? >>>>>>>>>> >>>>>>>>>>What's the best way to handle this? >>>>>>>>>> >>>>>>>>>>MTIA, >>>>>>>>>> >>>>>>>>>>Rocky >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>> >>>> >>>> >>>> >>>> >>>> >>> >>> >>> >>> >>> >> >> >> > > > -- Marty Connelly Victoria, B.C. Canada