Questions tagged [fso]

Object Model component on Windows systems that represents the local file system.

The FileSystemObject (FSO) Object Model is used to access the local file system. Among other things, it provides methods for

  • reading file properties
  • creating and deleting files and folders
  • reading from files

For a complete list, visit the documentation link below.

Questions using the tag are expected to relate to programming

Links:

118 questions
0
votes
1 answer

Why will be the last file the first one in vba for each?

I would like to list the files and subfolders to an Excel sheet with vba macro. The listing is working, but the last file of last folder moves to first place of actual folder in the list. Here is the result: And here is the code: If…
Pete
  • 13
  • 2
0
votes
1 answer

fastest way to copy files/folders vba

I've written a recursive script with a couple of if statements to append all files/folders in in vba using FSO but it takes forever, and I'm looking for other methodologies, or faster ways to append files. Is using the DIR or Call shell a faster…
user8285660
0
votes
1 answer

overwrite folders in visual basic script?

I'm working on a way to overwrite a folder if it already exists, with confirmation. Here is my code(along with the part I'm stuck on): Set fso = CreateObject("Scripting.FileSystemObject") Set shell = CreateObject("WScript.Shell") Set network =…
Stylerr.
  • 33
  • 6
0
votes
0 answers

In Excel-Word Interop, how do I use the File Object after using the Name function to rename it?

Overall objective: create an Excel-based file converter that interops with Word, changing several built-in document properties, header/footer text & pics, watermark, and file name. The new attributes/text/file paths are found in cells. After…
Starnes Student
  • 103
  • 1
  • 8
0
votes
1 answer

VBA - looping through folder.subfolders.files Crashes

I'm writting a VBA Macro in Excel that should o the following: Given a following path loops through the subfolders in that path (all subfolders begin with a sequencial number) Goes inside the subfolder which are in a numerical window defined as…
0
votes
2 answers

Lower run time (currently >3 hours) VBA loop through specific subfolders

I really appreciate the time you're taking to read my message, and I understand that Stack overflow's purpose is more for codes that are failing, however I am new and would like to get some of your tips VBA Question: I've seen similar questions…
user13009116
0
votes
0 answers

Looking for all files in a folder with a specific relation number in a textbox or combobox

I know how to get files from a folder to a table in access but as all the pdf documents have a name where the relation number is part of, I wonder if it's possible with vba to select all files containing for example number 12197 in its name, maybe…
0
votes
2 answers

VBS file not printing

I am new to VBS and I am trying to create a script that sorts some files in a folder and, if conditions are met, should output a MsgBox as well as printing the file. The MsgBox part works but the printing functionality doesn't work. Thanks for any…
0
votes
1 answer

Upload File to SharePoint through VBA

I've been seeing this code (or similar to this) in some forums but some do not have this lines for mapping: "objNet.MapNetworkDrive “A: ” , SharepointAddress" Is it safe for the computer/network to omit this code? Sub UploadToSharepoint() Dim…
Jercel
  • 3
  • 1
  • 1
  • 2
0
votes
1 answer

How to add the code to delete the older file if FSO copied file is newer than the file in the destination folder?

I am writing a VBA code to pull the file at the source folder and move to my folder to analyze it in order not to corrupt the original file. But, i am facing difficulties to write a code that replace the older file if detect the name is the…
0
votes
0 answers

FSO.Rename subfolders (Loop)

I would like to loop through all of my subfolders and rename them to "example". I don't know the folder names of all my subfolders. My code does not work at all. Example of Folder Structure: Main Folder >Subfolder A > Subfolder 1 (Rename this) …
Tom
  • 1
  • 2
0
votes
1 answer

FSO - DeleteFile issue

I'm running a routine delete all files within a folder, then delete the folder. It works, but always seems to leave one file behind. Assume some kind of file lock, but ideas on how to clear the lock would be appreciated. If I manually delete the…
BigIWT
  • 243
  • 1
  • 5
  • 14
0
votes
1 answer

VBA to copy solidworks files to a central folder

Good morning, a coworker of mine asked me to take a look at his VBA for Solidworks and I'm stumped as to what the issue is. Basically, he is searching through old solidworks drawings to find ones relevant to a new project he is working on. If he…
0
votes
0 answers

Is there a faster way to create a txt file?

In my Excel macro, the user would like it to create a txt file of the results. I am able to do so with the code below. At this time, it takes about 5 minutes to create a txt file with 110,000 lines. I'm afraid the user will complain about the…
Shaves
  • 884
  • 5
  • 16
  • 46
0
votes
0 answers

VBA Excel recursive folder search stops

I have script to scan a folder for files with a file name containing a certain text. The script works but it stops after sometime without finishing the scan of the complete folder (I reached 16663 scans, is there a limit?). I can't figure out why…