Home |
Search |
Today's Posts |
#1
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Maintaining cell reference after sorting | Excel Discussion (Misc queries) | |||
Absolute Worksheet reference number | Excel Discussion (Misc queries) | |||
Adding Smart Tags to an unrecognized cell reference | Excel Discussion (Misc queries) | |||
Adding to a range in a reference? | New Users to Excel | |||
bar code help, adding asterix to reference | Excel Discussion (Misc queries) |