Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

error on opening another application 2

Status
Not open for further replies.

flaviooooo

Programmer
Joined
Feb 24, 2003
Messages
496
Location
FR
Hey,

I'm trying to open a label that was created with codesoft, from access.
I have referenced the correct reference : TK Labeling ActiveX 6.0 and my code goes as follows:

Dim MyApp As LabelManager2.Application
Dim MyDoc As LabelManager2.Document
Dim MyVars As LabelManager2.Variables
Dim var As LabelManager2.Variable

Set MyApp = New LabelManager2.Application
MyApp.Visible = True
Set MyDoc = MyApp.Documents.Open("C:/Program Files/CS6/Lab/Grondstoffen.Lab")
Set MyVars = MyDoc.Variables
...

Unfortunately i get this error 'Object variable or With block variable not set (Error 91)' when it reaches Set MyVars...

This is because the label I tried to open (Grondstoffen.Lab), didn't open in the codesoft program.

Any ideas on what could be wrong?
Thanks!
 
oops, don't mind this thread!

Stupid me, I reversed the backslashes :-)
It should be C:\Program Files\CS6\Lab\Grondstoffen.Lab offcourse


Oh well, it's monday for everybody I guess ...

greetings
 
Hi

I am developing and app and I also need to open a codesoft label and print it from my VB app

Could you please post me your full code of your printing function

Hope you can help me

Thanks
 
OK, let's see :-)

First create this function

Function Maak_Label()
DoCmd.Hourglass True

Dim I, Y As Integer
Dim MyApp As LabelManager2.Application
Dim MyDoc As LabelManager2.Document
Dim MyVars As LabelManager2.Variables
Dim var As LabelManager2.Variable

Set MyApp = New LabelManager2.Application
'MyApp.Visible = False, else Codesoft opens in a new window
MyApp.Visible = False
Set MyDoc = MyApp.Documents.Open("C:\Program Files\CS6\Lab\Grondstoffen.Lab")
Set MyVars = MyDoc.Variables

'Values on a form that will be inserted in the label
Y = 1
Do While Y < 10
MyVars.FormVariables(&quot;veld&quot; & Y & &quot;&quot;).Value = IIf(IsNull(Forms(&quot;Frm_Label&quot;)(&quot;Veld&quot; & Y & &quot;&quot;)), &quot;&quot;, (Forms(&quot;Frm_Label&quot;)(&quot;Veld&quot; & Y & &quot;&quot;)))
Y = Y + 1
Loop


If Printen = True And Preview = False Then
'if you need to print
MyDoc.PrintDocument
Else
'if you want to show a preview
MyDoc.CopyToClipboard
End If

DoCmd.Hourglass False
MyApp.Documents.CloseAll True
MyApp.Quit
Set MyApp = Nothing

End Function

Then on the form, I have a print button with following code:

Private Sub Command25_Click()
Preview = False
Printen = True
Maak_Label
End Sub

It's as simple as that :-)

 
Thank you so much for the code. I'm trying to get codesoft to work with Access and I keep getting:

"Class does not support Automation or does not support expected interface."

Do you have to run Codesoft Enterprise to have the API's work with Access? When I install Premier, the library seems to be there and I've added it to my references.

Thanks for any insight as to what's required.

/Wendy
 
Wendy,

sorry for the late response but here it goes :

I'm not quite sure what you mean by your suestion, but I'll list the things I needed for my Access-application to work with CS

We run Codesoft 6 Network. In the access-references, you need to check TK Labeling ActiveX 6.0 (located c:\CS6\lppx2.tlb)

I hope this helps

Greetings,
flavio
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top