Adding References to a Project

M

ManicMiner17

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
 
J

Jim Cone

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" <[email protected]>
wrote in message
news:[email protected]...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top