Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Jim May
 
Posts: n/a
Default Adding a Reference in VBA

In order to run the below code what is the Official
exact name of the library I should have added/checked
in my Reference table?
TIA,

Sub Tester1()
Dim fso As Object
Dim fldr As Object
Set fso = CreateObject("Scripting.FileSystemObject")
Set fldr = fso.GetFolder("C:\Documents and Settings\Jim\My Documents")
MsgBox "You have " & fldr.Files.Count & " Files in the Excel Formulas
Folder"
End Sub


  #2   Report Post  
Dave Peterson
 
Posts: n/a
Default

microsoft scripting runtime

But then you could change your code to:

Sub Tester2()
Dim FSO As Scripting.FileSystemObject
Dim FLDR As Scripting.Folder
Set FSO = New Scripting.FileSystemObject
Set FLDR = FSO.GetFolder("C:\Documents and Settings\Jim\My Documents")
MsgBox "You have " & FLDR.Files.Count & " Files in the Excel Formulas Folder"
End Sub



Jim May wrote:

In order to run the below code what is the Official
exact name of the library I should have added/checked
in my Reference table?
TIA,

Sub Tester1()
Dim fso As Object
Dim fldr As Object
Set fso = CreateObject("Scripting.FileSystemObject")
Set fldr = fso.GetFolder("C:\Documents and Settings\Jim\My Documents")
MsgBox "You have " & fldr.Files.Count & " Files in the Excel Formulas
Folder"
End Sub


--

Dave Peterson
  #3   Report Post  
Jim May
 
Posts: n/a
Default

Thanks Dave; I made the change as you suggested.

"Dave Peterson" wrote in message
...
microsoft scripting runtime

But then you could change your code to:

Sub Tester2()
Dim FSO As Scripting.FileSystemObject
Dim FLDR As Scripting.Folder
Set FSO = New Scripting.FileSystemObject
Set FLDR = FSO.GetFolder("C:\Documents and Settings\Jim\My Documents")
MsgBox "You have " & FLDR.Files.Count & " Files in the Excel Formulas
Folder"
End Sub



Jim May wrote:

In order to run the below code what is the Official
exact name of the library I should have added/checked
in my Reference table?
TIA,

Sub Tester1()
Dim fso As Object
Dim fldr As Object
Set fso = CreateObject("Scripting.FileSystemObject")
Set fldr = fso.GetFolder("C:\Documents and Settings\Jim\My Documents")
MsgBox "You have " & fldr.Files.Count & " Files in the Excel Formulas
Folder"
End Sub


--

Dave Peterson



  #4   Report Post  
Dave Peterson
 
Posts: n/a
Default

In general, I'd use the code with the references while developing, but before I
distribute the code, I'll remove the reference, change the declarations, fix the
constants and release it that way.

The resulting code will work slightly slower, but you don't have to worry about
giving the workbook to a pc that has a different version of the reference I
used.

Jim May wrote:

Thanks Dave; I made the change as you suggested.

"Dave Peterson" wrote in message
...
microsoft scripting runtime

But then you could change your code to:

Sub Tester2()
Dim FSO As Scripting.FileSystemObject
Dim FLDR As Scripting.Folder
Set FSO = New Scripting.FileSystemObject
Set FLDR = FSO.GetFolder("C:\Documents and Settings\Jim\My Documents")
MsgBox "You have " & FLDR.Files.Count & " Files in the Excel Formulas
Folder"
End Sub



Jim May wrote:

In order to run the below code what is the Official
exact name of the library I should have added/checked
in my Reference table?
TIA,

Sub Tester1()
Dim fso As Object
Dim fldr As Object
Set fso = CreateObject("Scripting.FileSystemObject")
Set fldr = fso.GetFolder("C:\Documents and Settings\Jim\My Documents")
MsgBox "You have " & fldr.Files.Count & " Files in the Excel Formulas
Folder"
End Sub


--

Dave Peterson


--

Dave Peterson
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Maintaining cell reference after sorting GRITS Excel Discussion (Misc queries) 2 April 30th 23 07:42 PM
Absolute Worksheet reference number Tony M Excel Discussion (Misc queries) 4 March 21st 05 06:10 PM
Adding Smart Tags to an unrecognized cell reference SauveC Excel Discussion (Misc queries) 3 February 12th 05 02:01 AM
Adding to a range in a reference? LilaDuncan New Users to Excel 2 February 7th 05 03:12 PM
bar code help, adding asterix to reference R D S Excel Discussion (Misc queries) 1 January 17th 05 06:05 PM


All times are GMT +1. The time now is 01:12 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"