How to Search Application Name in CreateObject MS ACCESS

rpatil

Registered User.
Local time
Today, 13:56
Joined
Nov 17, 2006
Messages
12
Dose any one know how to search application name or how to add other application to CreateObject . For example the code below will open WORD and prints word document “Wordtest” from MS access , I need to do similar thing BUT for a different application ( Instead of Word I want to Open EasyLabel). I know WORD, EXCEL ,POWER POINT etc are COM application supported my MS Access.

Is there a way to add a different application to this list


Function PrintDoc()
Dim WordObj As Object
Set WordObj = CreateObject("Word.Application")
WordObj.Documents.Open "C:\Wordtest.doc"
WordObj.PrintOut Background:=False
WordObj.Quit
Set WordObj = Nothing
End Function

So I wrote this

Function Elabel()
Dim EasyLb As Object
Set EasyLb = CreateObject("EasyLabel.Application")
EasyLb.Documents.Open "C:\test.fmt"
EasyLb.PrintOut Background:=False
EasyLb.Quit
Set EasyLb = Nothing
End Function

This gives me error that ActiveX cannot create object

How do I search application names that are supported by ActiveX or how can we add other application to createobject ( why did the programmer put WORD.Application where did he come to know this .


My main aim it to print a Barcode template in EasyLabel from MS Access

The following code opens the template in easylabel but I want to print not open

'FmtPath = "C:\Program Files\Tharo\EASYLABEL Platinum\easy.exe C:\test.fmt"
'RetVal = Shell(FmtPath, vbMaximizedFocus)


CAN ANY ONE SUGGEST ME SOME SOLUTION

Thanks
 
This program of yours, probably have different objects, methods and properties than the Office apps, if you're lucky, the documentation or a web search might give you more info on that.

I think I'd take a look at the ShellExecute API.
Code:
Private Declare Function apiShellExecute _
        Lib "shell32.dll" Alias "ShellExecuteA" _
        (ByVal hwnd As Long, ByVal lpOperation As String, _
        ByVal lpFile As String, ByVal lpParameters As String, _
        ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long

'Then in the routine where you need to print, call it with:

lngReturn = apiShellExecute(hWndAccessApp, "print", _
strFileAndPath, vbNullString, vbNullString, 0)

The declaration comes from http://www.mvps.org/access/api/api0018.htm, which is a nice wrapper for the ShellExecute API, just pass "print" in stead of vbnullstring or "Open" as second arguement. In a form, you can pass the form handle in stead Me.hWnd
__________________
 
rpatil, Roy's solution might help you. But the ultimate issue is that if the target program doesn't expose its inner workings via COM standards, you can't open it as an application object.

The shell concept that Roy suggested works if and only if the application has a command line ability.

In either case, to answer your question about

How do I search application names that are supported by ActiveX or how can we add other application to createobject ( why did the programmer put WORD.Application where did he come to know this

You must search that application's help files to see what it allows you to do. If it has a section on programming interfaces, APIs, COM/DLL based operation, or some other mechanisms, you have a chance to make it work. Not a certainty, you understand, just a chance.

For future reference, if you want to run an application that neither has COM support nor a meaningful command line interface, you will not be able to run it from Access. You will need at least SOME cooperation from the application to make such a thing work from Access.
 

Users who are viewing this thread

Back
Top Bottom