File System Object

sassriverrat

Well-known Member
Joined
Oct 4, 2018
Messages
655
Is there a way to dim a FSO code so that a computer doesn't have to have the library checked off in the references tab? Otherwise I need to find a new way to copy a file in VBA without .CopyFolder and .CopyFile....thanks
 

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.
hmmmm...unfortunately I don't think I can do that because the file is active (open) when the code should run... essentially I'm using the copy feature to "save as"
 
Upvote 0
Awesome. So one more question: recommendations on a better way to check for a file existing then len(dir(xxname)) <> “” then?

thanks
 
Upvote 0
To use the FileSystemObject without the reference you could use late-binding.
Rich (BB code):
Dim FSO As Object

    Set FSO = CreateObject("Scripting.FileSystemObject")

    ' do things with file system object FSO
 
Last edited:
Upvote 0
Is there any scenario then when excel might not recognize FSO then because the references have been checked?
 
Upvote 0
Not sure what you mean, in the code I posted FSO is a variable with an arbitrary name - it shouldn't make a difference if the reference is checked or not.
 
Upvote 0

Forum statistics

Threads
1,214,651
Messages
6,120,744
Members
448,989
Latest member
mariah3

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top