PC Review


Reply
Thread Tools Rate Thread

Adding References to a Project

 
 
ManicMiner17
Guest
Posts: n/a
 
      13th Feb 2011
Hi,

I have an addin which I share with some work colleagues.

I recently added a reference to the Microsoft Scripting Runtime to allow
me to use the FileSystemObject. It opens the old version and imports a
phone list into the new blank addin.

Before I share the update I would like to figure out whether the new
code will work on my colleagues machines without having to explicitly
add the reference in their VBE? Is there a programmatic way to do so? Is
it possible to use Application.Run instead of adding a reference?

I've read a lot about references but haven't seen anything which deals
with this.

DB
 
Reply With Quote
 
 
 
 
Jim Cone
Guest
Posts: n/a
 
      13th Feb 2011
Your colleagues must be using the Windows operating system.
The FileSystemObject (FSO) is not included with Excel.
Setting the reference in the add you supply should work, almost all the time, except when
it doesn't.
A slightly more sure-footed method is to create the FSO on the fly using "late binding".
Declare all FSO variables as Objects and use CreateObject to grab an instance of the FSO:
'---
Dim fso as Object
Dim fsoFolder as Object
Dim fsoFile as Object

Set fso = CreateObject("Scripting.FileSystemObject")
'---
The above is less efficient than setting a direct reference, but I have never been able to
detect a difference in actual operation.
--
Jim Cone
Portland, Oregon USA
http://www.mediafire.com/PrimitiveSoftware
(List Files: specific files/folders with hyperlinks)




"ManicMiner17" <(E-Mail Removed)>
wrote in message
news:ij88sb$50p$(E-Mail Removed)...
> Hi, I have an addin which I share with some work colleagues.
>
> I recently added a reference to the Microsoft Scripting Runtime to allow me to use the
> FileSystemObject. It opens the old version and imports a phone list into the new blank
> addin.
>
> Before I share the update I would like to figure out whether the new code will work on
> my colleagues machines without having to explicitly add the reference in their VBE? Is
> there a programmatic way to do so? Is it possible to use Application.Run instead of
> adding a reference?
>
> I've read a lot about references but haven't seen anything which deals with this. DB



 
Reply With Quote
 
ManicMiner17
Guest
Posts: n/a
 
      13th Feb 2011
Thanks Jim,

Thats a great help!

DB

On 13/02/2011 14:12, Jim Cone wrote:
> Your colleagues must be using the Windows operating system.
> The FileSystemObject (FSO) is not included with Excel.
> Setting the reference in the add you supply should work, almost all the time, except when
> it doesn't.
> A slightly more sure-footed method is to create the FSO on the fly using "late binding".
> Declare all FSO variables as Objects and use CreateObject to grab an instance of the FSO:
> '---
> Dim fso as Object
> Dim fsoFolder as Object
> Dim fsoFile as Object
>
> Set fso = CreateObject("Scripting.FileSystemObject")
> '---
> The above is less efficient than setting a direct reference, but I have never been able to
> detect a difference in actual operation.

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Adding references in Access project Marc Microsoft Access Form Coding 4 24th Mar 2009 04:36 AM
Dynammically adding project references into the webproject. Anubhav Jain Microsoft Dot NET Framework Forms 0 17th Apr 2006 03:40 PM
Dynammically adding project references into the webproject. Anubhav Jain Microsoft C# .NET 0 17th Apr 2006 03:40 PM
Adding DLL references to VB.Net Project =?Utf-8?B?RGVubmlz?= Microsoft VB .NET 6 18th Dec 2004 10:17 PM
automatically including other references when adding a DLL to a project Bob Microsoft VB .NET 4 28th Aug 2003 12:48 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:16 AM.