|
|||
|
I have some code in A2010 that interfaces with SolidWorks EPDM api using
early binding. Some user don't have EPDM installed so I would like to use late binder, currently I have to maintain 2 version of the FE. The problem is EPDM is a Windows File Explore add-on and has no separate user interface to call using something like CreateObject("Outlook.Application"). How can I late bind with an add-on application? |
|
|
||||
|
||||
|
|
|
|||
|
ron paii wrote:
> I have some code in A2010 that interfaces with SolidWorks EPDM api > using early binding. Some user don't have EPDM installed so I would > like to use late binder, currently I have to maintain 2 version of > the FE. The problem is EPDM is a Windows File Explore add-on and has > no separate user interface to call using something like > CreateObject("Outlook.Application"). How can I late bind with an > add-on application? A user interface is not required. For example, you can use late binding with a DAO object: set db=createobject("DAO.Database") |
|
|||
|
"ron paii" <none@nospam.com> wrote in message
news:j4q77f$jjk$1@dont-email.me... >I have some code in A2010 that interfaces with SolidWorks EPDM api using >early binding. Some user don't have EPDM installed so I would like to use >late binder, currently I have to maintain 2 version of the FE. The problem >is EPDM is a Windows File Explore add-on and has no separate user interface >to call using something like CreateObject("Outlook.Application"). How can I >late bind with an add-on application? Late binding will not work if the software is not installed at all. You cannot create a connection to software that just isn't there. The difference between early and late binding is speed and versioning. The difference in code is like this: Early Binding: ' Declare the object as an early-bound object Dim objAccess As Access.Application Set objAccess = CreateObject("Access.Application") ' The Visible property is called objAccess.Visible = True Late Binding: ' Declare the object as a late-bound object Dim objAccess As Object Set objAccess = CreateObject("Access.Application") ' The Visible property is called objAccess.Visible = True -- Arvin Meyer, MCP, MVP http://www.datastrat.com http://www.accessmvp.com http://access.mvps.org Co-author: "Access Solutions", published by Wiley |
|
|||
|
"Arvin Meyer" <arvinm@invalid.org> wrote in message news:bqmdnRYmqcv9M-3TnZ2dnUVZ_qCdnZ2d@earthlink.com... > "ron paii" <none@nospam.com> wrote in message > news:j4q77f$jjk$1@dont-email.me... >>I have some code in A2010 that interfaces with SolidWorks EPDM api using >>early binding. Some user don't have EPDM installed so I would like to use >>late binder, currently I have to maintain 2 version of the FE. The problem >>is EPDM is a Windows File Explore add-on and has no separate user >>interface to call using something like >>CreateObject("Outlook.Application"). How can I late bind with an add-on >>application? > > > Late binding will not work if the software is not installed at all. You > cannot create a connection to software that just isn't there. The > difference between early and late binding is speed and versioning. The > difference in code is like this: > > Early Binding: > ' Declare the object as an early-bound object > Dim objAccess As Access.Application > > Set objAccess = CreateObject("Access.Application") > > ' The Visible property is called > objAccess.Visible = True > > > Late Binding: > ' Declare the object as a late-bound object > Dim objAccess As Object > > Set objAccess = CreateObject("Access.Application") > > ' The Visible property is called > objAccess.Visible = True > > -- > Arvin Meyer, MCP, MVP > http://www.datastrat.com > http://www.accessmvp.com > http://access.mvps.org > Co-author: "Access Solutions", published by Wiley > With late binding, I can check if the application is not installed and not run the code. With early binding the FE cannot be loaded if the application is missing. |
|
|||
|
On Wed, 14 Sep 2011 07:38:06 -0500, "ron paii" <none@nospam.com>
wrote: >I have some code in A2010 that interfaces with SolidWorks EPDM api using >early binding. Some user don't have EPDM installed so I would like to use >late binder, currently I have to maintain 2 version of the FE. The problem >is EPDM is a Windows File Explore add-on and has no separate user interface >to call using something like CreateObject("Outlook.Application"). How can I >late bind with an add-on application? Can you post some sample code showing how you start using it? Tony -- Tony Toews, Microsoft Access MVP Tony's Main MS Access pages - http://www.granite.ab.ca/accsmstr.htm Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/ For a convenient utility to keep your users FEs and other files updated see http://www.autofeupdater.com/ |
|
|||
|
"Tony Toews" <ttoews@telusplanet.net> wrote in message news:m9227710ts4td27kqkajuo61pu6eplvqsj@4ax.com... > On Wed, 14 Sep 2011 07:38:06 -0500, "ron paii" <none@nospam.com> > wrote: > >>I have some code in A2010 that interfaces with SolidWorks EPDM api using >>early binding. Some user don't have EPDM installed so I would like to use >>late binder, currently I have to maintain 2 version of the FE. The problem >>is EPDM is a Windows File Explore add-on and has no separate user >>interface >>to call using something like CreateObject("Outlook.Application"). How can >>I >>late bind with an add-on application? > > Can you post some sample code showing how you start using it? > > Tony > -- > Tony Toews, Microsoft Access MVP > Tony's Main MS Access pages - http://www.granite.ab.ca/accsmstr.htm > Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/ > For a convenient utility to keep your users FEs and other files > updated see http://www.autofeupdater.com/ This is the function I use to login to EPDM '------------------- ' Opens the Vault and hold open in static var ' Keep ref to vault open for improved speed ' ' Return Reference to the vault ' Private Function EPDM_GetVault() As EdmVault5 Static m_Vault As IEdmVault12 ' Open vault If m_Vault Is Nothing Then Set m_Vault = New EdmVault5 ' Loginto vault, using current user login Call m_Vault.LoginAuto("SWVault", "None"), _ GetAccesshWnd()) Else If Not m_Vault.IsLoggedIn Then ' Loginto vault, using current user login Call m_Vault.LoginAuto("SWVault", "None"), GetAccesshWnd()) End If End If Set EPDM_GetVault = m_Vault ' Return reference to Vault Exit Function End Function |
|
|||
|
"ron paii" <none@nospam.com> wrote in message news:j4r6jl$ipt$1@dont-email.me... > > > "Tony Toews" <ttoews@telusplanet.net> wrote in message > news:m9227710ts4td27kqkajuo61pu6eplvqsj@4ax.com... >> On Wed, 14 Sep 2011 07:38:06 -0500, "ron paii" <none@nospam.com> >> wrote: >> >>>I have some code in A2010 that interfaces with SolidWorks EPDM api using >>>early binding. Some user don't have EPDM installed so I would like to use >>>late binder, currently I have to maintain 2 version of the FE. The >>>problem >>>is EPDM is a Windows File Explore add-on and has no separate user >>>interface >>>to call using something like CreateObject("Outlook.Application"). How can >>>I >>>late bind with an add-on application? >> >> Can you post some sample code showing how you start using it? >> >> Tony >> -- >> Tony Toews, Microsoft Access MVP >> Tony's Main MS Access pages - http://www.granite.ab.ca/accsmstr.htm >> Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/ >> For a convenient utility to keep your users FEs and other files >> updated see http://www.autofeupdater.com/ > > This is the function I use to login to EPDM > > '------------------- > ' Opens the Vault and hold open in static var > ' Keep ref to vault open for improved speed > ' > ' Return Reference to the vault > ' > Private Function EPDM_GetVault() As EdmVault5 > > Static m_Vault As IEdmVault12 > > ' Open vault > If m_Vault Is Nothing Then > Set m_Vault = New EdmVault5 > ' Loginto vault, using current user login > Call m_Vault.LoginAuto("SWVault", "None"), _ > GetAccesshWnd()) > Else > If Not m_Vault.IsLoggedIn Then > ' Loginto vault, using current user login > Call m_Vault.LoginAuto("SWVault", "None"), GetAccesshWnd()) > End If > End If > > Set EPDM_GetVault = m_Vault ' Return reference to Vault > Exit Function > > End Function . I strip out code that looks up the vault name "SWVault" Call m_Vault.LoginAuto("SWVault", "None"), GetAccesshWnd()) should be Call m_Vault.LoginAuto("SWVault", "None", GetAccesshWnd()) |
|
|||
|
"Arvin Meyer" <arvinm@invalid.org> wrote in
news:bqmdnRYmqcv9M-3TnZ2dnUVZ_qCdnZ2d@earthlink.com: > Late binding will not work if the software is not installed at > all. You cannot create a connection to software that just isn't > there. The difference between early and late binding is speed and > versioning. Well, there's also recoverability when the external component is not installed. I really don't think the OP thought the software would somehow magically work if not installed but programmed through late binding -- I think all he wanted to do was fail gracefully, since it allows you to continue running code and tell the user it's not installed. -- David W. Fenton http://www.dfenton.com/ contact via website only http://www.dfenton.com/DFA/ |
|
|||
|
"ron paii" <none@nospam.com> wrote in
news:j4q77f$jjk$1@dont-email.me: > I have some code in A2010 that interfaces with SolidWorks EPDM api > using early binding. Basically, you need to find the name of the component that you need to initialize with CreateObject. You have to poke around the registry for this. I would start by looking up the name of the file in the early binding reference, and then search the registry for that. -- David W. Fenton http://www.dfenton.com/ contact via website only http://www.dfenton.com/DFA/ |
|
|||
|
"ron paii" <none@nospam.com> wrote in
news:j4tef4$kog$1@dont-email.me: > > > "David-W-Fenton" <NoEmail@SeeSignature.invalid> wrote in message > news:Xns9F618D09F12E8f99a49ed1d0c49c5bbb2@88.198.2 44.100... >> "ron paii" <none@nospam.com> wrote in >> news:j4q77f$jjk$1@dont-email.me: >> >>> I have some code in A2010 that interfaces with SolidWorks EPDM >>> api using early binding. >> >> Basically, you need to find the name of the component that you >> need to initialize with CreateObject. You have to poke around the >> registry for this. I would start by looking up the name of the >> file in the early binding reference, and then search the registry >> for that. > > With this API New is used instead of CreateObject. I am thinking > that the application is running under Windows explorer. See my > code posted earler. If it's a COM component, it shouldn't matter. -- David W. Fenton http://www.dfenton.com/ contact via website only http://www.dfenton.com/DFA/ |
|
|||
|
ron paii wrote:
> "David-W-Fenton" <NoEmail@SeeSignature.invalid> wrote in message > news:Xns9F618D09F12E8f99a49ed1d0c49c5bbb2@88.198.2 44.100... >> "ron paii" <none@nospam.com> wrote in >> news:j4q77f$jjk$1@dont-email.me: >> >>> I have some code in A2010 that interfaces with SolidWorks EPDM api >>> using early binding. >> >> Basically, you need to find the name of the component that you need >> to initialize with CreateObject. You have to poke around the >> registry for this. I would start by looking up the name of the file >> in the early binding reference, and then search the registry for >> that. >> > > With this API New is used instead of CreateObject. I am thinking that > the application is running under Windows explorer. See my code posted > earler. It's a COM object or else you wouldn't be able to use it in VBA. What you need to find out is the name of the COM library containing that object. Let's look at your code: > Set m_Vault = New EdmVault5 So what this line of code does is instantiates a new EdmVault5 object and points the m_Vault variable at it. Notice that you did not have to qualify the EdmVault5 object name with the name of the COM library that contains the object. The reason this line of code works is that you set a reference to the library containing this object in Tools>References. Because you did that, you did not have to use CreateObject to instantiate it. In addition, you were also relieved of the requirement to qualify the object name with its library name. If you try to create a recordset object using Set rs=New Recordset when you have both ADO and DAO references, you have to qualify the object name in order not to get the "default" object, which depends on the order the references appear in your References list. I.E., if ActiveX Data Objects appears first, you will get an ADODB recordset. If DAO is first, you will get a DAO recordset. In order to control which one you get, you need to qualify the object with the name of the library. To guarantee you get a DAO recordset, you need to use: Set rs=New DAO.Recordset If you want an ADO recordset you need to use Set rs=New ADODB.Recordst If you want to use late binding to get an ADO recordset (without setting a reference), you have to use CreateObject (using New requires a Reference) and you have to use the fully qualified object name when calling CreateObject: Set rs=CreateObject("ADODB.Recordset") Are things becoming clearer yet? Hopefully you are beginning to realize the need to discover the name of the library containing that EdmVault5 object. I think the easiest way to do that is to use the Object Browser in the VBA IDE. When you open the Object Browser (press F2 while a code window is open), you should see a dropdown that will contain the names of all the libraries for which you have set References (usually Access, DAO, VBA and stdole will be listed, along with any other libraries you have Referenced). It should be fairly simple to look at that list and figure out which one is the EDM library. If not, type EdmVault5 into the search box and click the search button. The search results include a column for the name of the library containing the class (object). Alternatively, you can search your machine's registry to discover the name of the library, but you should not have to if you've added a Reference to the library. Anyways, once you have the name of the library, you should be able to instantiate EdmVault5 using: set m_Vault=CreateObject("<libraryname>.EdmVault5") |
|
|||
|
"Bob Barrows" <reb01501@NOyahooSPAM.com> wrote in message news:j57m9d$6gc$1@dont-email.me... > ron paii wrote: >> "David-W-Fenton" <NoEmail@SeeSignature.invalid> wrote in message >> news:Xns9F618D09F12E8f99a49ed1d0c49c5bbb2@88.198.2 44.100... >>> "ron paii" <none@nospam.com> wrote in >>> news:j4q77f$jjk$1@dont-email.me: >>> >>>> I have some code in A2010 that interfaces with SolidWorks EPDM api >>>> using early binding. >>> >>> Basically, you need to find the name of the component that you need >>> to initialize with CreateObject. You have to poke around the >>> registry for this. I would start by looking up the name of the file >>> in the early binding reference, and then search the registry for >>> that. >>> >> >> With this API New is used instead of CreateObject. I am thinking that >> the application is running under Windows explorer. See my code posted >> earler. > > It's a COM object or else you wouldn't be able to use it in VBA. What you > need to find out is the name of the COM library containing that object. > Let's look at your code: > >> Set m_Vault = New EdmVault5 > > So what this line of code does is instantiates a new EdmVault5 object and > points the m_Vault variable at it. Notice that you did not have to qualify > the EdmVault5 object name with the name of the COM library that contains > the > object. > > The reason this line of code works is that you set a reference to the > library containing this object in Tools>References. Because you did that, > you did not have to use CreateObject to instantiate it. In addition, you > were also relieved of the requirement to qualify the object name with its > library name. > > If you try to create a recordset object using > > Set rs=New Recordset > > when you have both ADO and DAO references, you have to qualify the object > name in order not to get the "default" object, which depends on the order > the references appear in your References list. I.E., if ActiveX Data > Objects > appears first, you will get an ADODB recordset. If DAO is first, you will > get a DAO recordset. In order to control which one you get, you need to > qualify the object with the name of the library. > > To guarantee you get a DAO recordset, you need to use: > Set rs=New DAO.Recordset > If you want an ADO recordset you need to use > Set rs=New ADODB.Recordst > > If you want to use late binding to get an ADO recordset (without setting a > reference), you have to use CreateObject (using New requires a Reference) > and you have to use the fully qualified object name when calling > CreateObject: > Set rs=CreateObject("ADODB.Recordset") > > Are things becoming clearer yet? Hopefully you are beginning to realize > the > need to discover the name of the library containing that EdmVault5 object. > I > think the easiest way to do that is to use the Object Browser in the VBA > IDE. When you open the Object Browser (press F2 while a code window is > open), you should see a dropdown that will contain the names of all the > libraries for which you have set References (usually Access, DAO, VBA and > stdole will be listed, along with any other libraries you have > Referenced). > It should be fairly simple to look at that list and figure out which one > is > the EDM library. If not, type EdmVault5 into the search box and click the > search button. The search results include a column for the name of the > library containing the class (object). > > Alternatively, you can search your machine's registry to discover the name > of the library, but you should not have to if you've added a Reference to > the library. > > Anyways, once you have the name of the library, you should be able to > instantiate EdmVault5 using: > set m_Vault=CreateObject("<libraryname>.EdmVault5") > > > After adding a reference to "PDMWorks Enterprise 2011 Type Library The library name listed in Object Browser is EDMLIB Replacing Set m_Vault = New EdmVault5 with Set m_Vault = CreateObject("EdmLib.EdmVault5") results in error number 429, ActiveX component can't create object I am thinking that because it is implemented as a file explorer add-on, I need to automate explorer? |
|
|||
|
ron paii wrote:
> After adding a reference to "PDMWorks Enterprise 2011 Type Library > The library name listed in Object Browser is EDMLIB > > Replacing > Set m_Vault = New EdmVault5 > with > Set m_Vault = CreateObject("EdmLib.EdmVault5") > results in error number 429, ActiveX component can't create object > > I am thinking that because it is implemented as a file explorer > add-on, I need to automate explorer? In my experience, if you can use New to instantiate an object, you should be able to use CreateObject. This is puzzling. What happens if you try Set m_Vault = New EdmLib.EdmVault5 ? If that also fails, then that cannot be the library's name. I suggest you try to find a forum/group devoted to that tool and ask there. |
|
|||
|
"Bob Barrows" <reb01501@NOyahooSPAM.com> wrote in message news:j57se1$hcb$1@dont-email.me... > ron paii wrote: >> After adding a reference to "PDMWorks Enterprise 2011 Type Library >> The library name listed in Object Browser is EDMLIB >> >> Replacing >> Set m_Vault = New EdmVault5 >> with >> Set m_Vault = CreateObject("EdmLib.EdmVault5") >> results in error number 429, ActiveX component can't create object >> >> I am thinking that because it is implemented as a file explorer >> add-on, I need to automate explorer? > > In my experience, if you can use New to instantiate an object, you should > be > able to use CreateObject. This is puzzling. > > What happens if you try > Set m_Vault = New EdmLib.EdmVault5 > ? If that also fails, then that cannot be the library's name. > > I suggest you try to find a forum/group devoted to that tool and ask > there. > > > > Thanks for your help Set m_Vault = New EdmLib.EdmVault5 worked. All the support for this API is in .NET, I had to translate it to Access/VBA. |
|
|||
|
"Bob Barrows" <reb01501@NOyahooSPAM.com> wrote in message news:j57vnh$9hg$1@dont-email.me... > ron paii wrote: >> "Bob Barrows" <reb01501@NOyahooSPAM.com> wrote in message >> news:j57se1$hcb$1@dont-email.me... >>> ron paii wrote: >>>> After adding a reference to "PDMWorks Enterprise 2011 Type Library >>>> The library name listed in Object Browser is EDMLIB >>>> >>>> Replacing >>>> Set m_Vault = New EdmVault5 >>>> with >>>> Set m_Vault = CreateObject("EdmLib.EdmVault5") >>>> results in error number 429, ActiveX component can't create object >>>> >>>> I am thinking that because it is implemented as a file explorer >>>> add-on, I need to automate explorer? >>> >>> In my experience, if you can use New to instantiate an object, you >>> should be >>> able to use CreateObject. This is puzzling. >>> >>> What happens if you try >>> Set m_Vault = New EdmLib.EdmVault5 >>> ? If that also fails, then that cannot be the library's name. >>> >> >> Set m_Vault = New EdmLib.EdmVault5 >> worked. >> >> All the support for this API is in .NET, I had to translate it to >> Access/VBA. > > The only explanation I can come up with for this is that EdmLib depends on > another library. Adding a Reference makes that transparent so you don't > need > to fully qualify it using New. Without the Reference, you need to > explicitly > qualify every part of the path that gets you to EdmVault5. I would use > Object Explorer to dig into it. Perhaps SysInternals Process Explorer can > help. > > I didn't think of Process Explorer. If the 1st reference of EPDM application is though explorer.exe, process explorer creates EdmServer.exe under explorer.exe on the same level as Access. If the 1st reference to EPDM is from Access it is under MSAccess.exe; If I close Access EDMServer.exe is restarted on the same level as explorer.exe. In all cases it creates 5 copies of the same dll "EdmInterface.dll!DllUnregisterServer+0xc4188" . |
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|