<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Setting References Programmatically in VBA Forum</title>
    <link>https://forums.autodesk.com/t5/vba-forum/setting-references-programmatically/m-p/1873811#M27942</link>
    <description>Hi Benny,&lt;BR /&gt;
&lt;BR /&gt;
When you use ActiveX programming (such as VB or VBA), you should use Windows &lt;BR /&gt;
to register the DLLs, OCXs etc.  In the VBA References you then select the &lt;BR /&gt;
reference from the list.  DO NOT BROWSE and select a file.  If the file you &lt;BR /&gt;
are trying to link with is not visible in the list, you should then &lt;BR /&gt;
register*** it to make it available.&lt;BR /&gt;
&lt;BR /&gt;
That way the the DVB uses the Windows environment to find the file and does &lt;BR /&gt;
not rely on the user doing what you describe.  This is how all commercial &lt;BR /&gt;
developers distribute their password protected files where in the user has &lt;BR /&gt;
no access to the code to change references.&lt;BR /&gt;
&lt;BR /&gt;
If you have a custom DLL, then it should be copied with the VBA program and &lt;BR /&gt;
registered in its new location.&lt;BR /&gt;
&lt;BR /&gt;
This is why you need an installation program like "Inno Setup" for such &lt;BR /&gt;
program distribution.&lt;BR /&gt;
Also, You need an understanding of the DLLs - are they yours and were &lt;BR /&gt;
developed in conjunction with your DVB, or are the commercial DLLs, or &lt;BR /&gt;
Window's ones?  Each should be handled differently.  Only the first type can &lt;BR /&gt;
reasonably be placed in the directory with your DVB.&lt;BR /&gt;
-- &lt;BR /&gt;
&lt;BR /&gt;
*** Type Regsvr32 in the Windows Run Box, then use Windows Explorer to drag &lt;BR /&gt;
your file into the box and press enter.&lt;BR /&gt;
&lt;BR /&gt;
Laurie Comerford&lt;BR /&gt;
CADApps&lt;BR /&gt;
www.cadapps.com.au&lt;BR /&gt;
www.civil3Dtools.com&lt;BR /&gt;
&lt;BR /&gt;
&lt;BENNY&gt; wrote in message news:5466342@discussion.autodesk.com...&lt;BR /&gt;
Hi Laurie&lt;BR /&gt;
&lt;BR /&gt;
Yes you are right the references are in dvb, but not all references are &lt;BR /&gt;
available on all the machines because of the the program runs in one system &lt;BR /&gt;
and gives error in another system.To solve this one has to go to VBAIDE open &lt;BR /&gt;
references menu and set the path for the missing one.&lt;BR /&gt;
This procedure can be carried out easily by a VBA programmer but not by &lt;BR /&gt;
ordinary user.&lt;BR /&gt;
&lt;BR /&gt;
So to solve this problem what i thought was to copy all references files &lt;BR /&gt;
(.dll .ocx or whaterver) and put in a directory along with the .dvb files so &lt;BR /&gt;
that the VBA programs and its depending files can be circulated easily.&lt;BR /&gt;
&lt;BR /&gt;
 But to work it we have to write a code so that every time you run it &lt;BR /&gt;
automatically adds references from the directory which we specify.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
I tried this code but its not working.&lt;BR /&gt;
&lt;BR /&gt;
Sub ADDRef()&lt;BR /&gt;
Dim NewRef as References&lt;BR /&gt;
&lt;BR /&gt;
Set NewRef =New References&lt;BR /&gt;
&lt;BR /&gt;
NewRef.Addfromfile ("C:\Myprogram\refedit.dll")&lt;BR /&gt;
&lt;BR /&gt;
End sub&lt;BR /&gt;
&lt;BR /&gt;
I think some modification is required for this program. can you help me.&lt;BR /&gt;
Thanks&lt;BR /&gt;
Benny&lt;/BENNY&gt;</description>
    <pubDate>Sun, 28 Jan 2007 19:53:23 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2007-01-28T19:53:23Z</dc:date>
    <item>
      <title>Setting References Programmatically</title>
      <link>https://forums.autodesk.com/t5/vba-forum/setting-references-programmatically/m-p/1873807#M27938</link>
      <description>I've read in several posts that you can set references programmatically.  I have created and incorporated a scripting dictionary in my first ever VBA routine.  Of course I had to check the Microsoft Scripting Runtime in References to create it, and it looks like my end users will have to do the same.  So I'd like for the program to do it without user intervention.&lt;BR /&gt;
&lt;BR /&gt;
In a really old post, Joe Sutphin showed how to create an AddReference function but prefaced it by saying "You must set a reference to 'Microsoft Visual Basic Extensibility 5.3' for this to work.  So, for my purposes, it looks like I might as well just go to each machine and reference Microsoft Scripting Runtime and forget trying to do it programmatically.  Have I misunderstood something?</description>
      <pubDate>Fri, 26 Jan 2007 18:04:34 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/setting-references-programmatically/m-p/1873807#M27938</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2007-01-26T18:04:34Z</dc:date>
    </item>
    <item>
      <title>Re: Setting References Programmatically</title>
      <link>https://forums.autodesk.com/t5/vba-forum/setting-references-programmatically/m-p/1873808#M27939</link>
      <description>Hi,&lt;BR /&gt;
&lt;BR /&gt;
When you add a reference to a VBA project, the reference is stored in the &lt;BR /&gt;
DVB and you can readily copy the DVB file to another computer and it will &lt;BR /&gt;
work - provided the referenced object is available on the other computer.&lt;BR /&gt;
As the Scripting Object is installed with Windows, you can feel reasonably &lt;BR /&gt;
comfortable using it.&lt;BR /&gt;
&lt;BR /&gt;
-- &lt;BR /&gt;
&lt;BR /&gt;
Laurie Comerford&lt;BR /&gt;
CADApps&lt;BR /&gt;
www.cadapps.com.au&lt;BR /&gt;
www.civil3Dtools.com&lt;BR /&gt;
&lt;SHUFFER&gt; wrote in message news:5465418@discussion.autodesk.com...&lt;BR /&gt;
I've read in several posts that you can set references programmatically.  I &lt;BR /&gt;
have created and incorporated a scripting dictionary in my first ever VBA &lt;BR /&gt;
routine.  Of course I had to check the Microsoft Scripting Runtime in &lt;BR /&gt;
References to create it, and it looks like my end users will have to do the &lt;BR /&gt;
same.  So I'd like for the program to do it without user intervention.&lt;BR /&gt;
&lt;BR /&gt;
In a really old post, Joe Sutphin showed how to create an AddReference &lt;BR /&gt;
function but prefaced it by saying "You must set a reference to 'Microsoft &lt;BR /&gt;
Visual Basic Extensibility 5.3' for this to work.  So, for my purposes, it &lt;BR /&gt;
looks like I might as well just go to each machine and reference Microsoft &lt;BR /&gt;
Scripting Runtime and forget trying to do it programmatically.  Have I &lt;BR /&gt;
misunderstood something?&lt;/SHUFFER&gt;</description>
      <pubDate>Fri, 26 Jan 2007 18:18:07 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/setting-references-programmatically/m-p/1873808#M27939</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2007-01-26T18:18:07Z</dc:date>
    </item>
    <item>
      <title>Re: Setting References Programmatically</title>
      <link>https://forums.autodesk.com/t5/vba-forum/setting-references-programmatically/m-p/1873809#M27940</link>
      <description>Thank you,&lt;BR /&gt;
&lt;BR /&gt;
Your assurance about the references being saved in the DVB led me to believe something was wrong with the way I was testing the code.  It works now.  Even though I had saved the DVB, I hadn't unloaded then reloaded it before trying to test it.  Does that make sense?</description>
      <pubDate>Fri, 26 Jan 2007 20:13:22 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/setting-references-programmatically/m-p/1873809#M27940</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2007-01-26T20:13:22Z</dc:date>
    </item>
    <item>
      <title>Re: Setting References Programmatically</title>
      <link>https://forums.autodesk.com/t5/vba-forum/setting-references-programmatically/m-p/1873810#M27941</link>
      <description>Hi Laurie&lt;BR /&gt;
&lt;BR /&gt;
Yes you are right the references are in dvb, but not all references are available on all the machines because of the the program runs in one system and gives error in another system.To solve this one has to go to VBAIDE open references menu and set the path for the missing one.&lt;BR /&gt;
This procedure can be carried out easily by a VBA programmer but not by ordinary user.&lt;BR /&gt;
&lt;BR /&gt;
So to solve this problem what i thought was to copy all references files (.dll .ocx or whaterver) and put in a directory along with the .dvb files so that the VBA programs and its depending files can be circulated easily.&lt;BR /&gt;
&lt;BR /&gt;
 But to work it we have to write a code so that every time you run it  automatically adds references from the directory which we specify.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
I tried this code but its not working.&lt;BR /&gt;
&lt;BR /&gt;
Sub ADDRef()&lt;BR /&gt;
Dim NewRef as References&lt;BR /&gt;
&lt;BR /&gt;
Set NewRef =New References&lt;BR /&gt;
&lt;BR /&gt;
NewRef.Addfromfile ("C:\Myprogram\refedit.dll")&lt;BR /&gt;
&lt;BR /&gt;
End sub&lt;BR /&gt;
&lt;BR /&gt;
I think some modification is required for this program. can you help me.&lt;BR /&gt;
Thanks&lt;BR /&gt;
Benny</description>
      <pubDate>Sun, 28 Jan 2007 13:27:55 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/setting-references-programmatically/m-p/1873810#M27941</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2007-01-28T13:27:55Z</dc:date>
    </item>
    <item>
      <title>Re: Setting References Programmatically</title>
      <link>https://forums.autodesk.com/t5/vba-forum/setting-references-programmatically/m-p/1873811#M27942</link>
      <description>Hi Benny,&lt;BR /&gt;
&lt;BR /&gt;
When you use ActiveX programming (such as VB or VBA), you should use Windows &lt;BR /&gt;
to register the DLLs, OCXs etc.  In the VBA References you then select the &lt;BR /&gt;
reference from the list.  DO NOT BROWSE and select a file.  If the file you &lt;BR /&gt;
are trying to link with is not visible in the list, you should then &lt;BR /&gt;
register*** it to make it available.&lt;BR /&gt;
&lt;BR /&gt;
That way the the DVB uses the Windows environment to find the file and does &lt;BR /&gt;
not rely on the user doing what you describe.  This is how all commercial &lt;BR /&gt;
developers distribute their password protected files where in the user has &lt;BR /&gt;
no access to the code to change references.&lt;BR /&gt;
&lt;BR /&gt;
If you have a custom DLL, then it should be copied with the VBA program and &lt;BR /&gt;
registered in its new location.&lt;BR /&gt;
&lt;BR /&gt;
This is why you need an installation program like "Inno Setup" for such &lt;BR /&gt;
program distribution.&lt;BR /&gt;
Also, You need an understanding of the DLLs - are they yours and were &lt;BR /&gt;
developed in conjunction with your DVB, or are the commercial DLLs, or &lt;BR /&gt;
Window's ones?  Each should be handled differently.  Only the first type can &lt;BR /&gt;
reasonably be placed in the directory with your DVB.&lt;BR /&gt;
-- &lt;BR /&gt;
&lt;BR /&gt;
*** Type Regsvr32 in the Windows Run Box, then use Windows Explorer to drag &lt;BR /&gt;
your file into the box and press enter.&lt;BR /&gt;
&lt;BR /&gt;
Laurie Comerford&lt;BR /&gt;
CADApps&lt;BR /&gt;
www.cadapps.com.au&lt;BR /&gt;
www.civil3Dtools.com&lt;BR /&gt;
&lt;BR /&gt;
&lt;BENNY&gt; wrote in message news:5466342@discussion.autodesk.com...&lt;BR /&gt;
Hi Laurie&lt;BR /&gt;
&lt;BR /&gt;
Yes you are right the references are in dvb, but not all references are &lt;BR /&gt;
available on all the machines because of the the program runs in one system &lt;BR /&gt;
and gives error in another system.To solve this one has to go to VBAIDE open &lt;BR /&gt;
references menu and set the path for the missing one.&lt;BR /&gt;
This procedure can be carried out easily by a VBA programmer but not by &lt;BR /&gt;
ordinary user.&lt;BR /&gt;
&lt;BR /&gt;
So to solve this problem what i thought was to copy all references files &lt;BR /&gt;
(.dll .ocx or whaterver) and put in a directory along with the .dvb files so &lt;BR /&gt;
that the VBA programs and its depending files can be circulated easily.&lt;BR /&gt;
&lt;BR /&gt;
 But to work it we have to write a code so that every time you run it &lt;BR /&gt;
automatically adds references from the directory which we specify.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
I tried this code but its not working.&lt;BR /&gt;
&lt;BR /&gt;
Sub ADDRef()&lt;BR /&gt;
Dim NewRef as References&lt;BR /&gt;
&lt;BR /&gt;
Set NewRef =New References&lt;BR /&gt;
&lt;BR /&gt;
NewRef.Addfromfile ("C:\Myprogram\refedit.dll")&lt;BR /&gt;
&lt;BR /&gt;
End sub&lt;BR /&gt;
&lt;BR /&gt;
I think some modification is required for this program. can you help me.&lt;BR /&gt;
Thanks&lt;BR /&gt;
Benny&lt;/BENNY&gt;</description>
      <pubDate>Sun, 28 Jan 2007 19:53:23 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/setting-references-programmatically/m-p/1873811#M27942</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2007-01-28T19:53:23Z</dc:date>
    </item>
    <item>
      <title>Re: Setting References Programmatically</title>
      <link>https://forums.autodesk.com/t5/vba-forum/setting-references-programmatically/m-p/1873812#M27943</link>
      <description>Hi Laurie&lt;BR /&gt;
&lt;BR /&gt;
Thank you very much for your information ....I need to work on that..</description>
      <pubDate>Mon, 29 Jan 2007 12:24:09 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/setting-references-programmatically/m-p/1873812#M27943</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2007-01-29T12:24:09Z</dc:date>
    </item>
  </channel>
</rss>

