fso

  1. P

    Help with VBA Code NOT writing to Text File correctly

    Hi there, The code below is 90% working. The issue I am having is that the code move the 8 test files into the specified folder as expected. But does not write the file detail to the audit file as expected. It appears that the code is overwriting line 1 and not append the data I have tried &...
  2. P

    VBA Run time Error "424

    I am having a problem with the VBA code below it works fine with Fileout.Write "This is a test" but files when Fileout.Write Cl.Value, Fldr & "" Also it seems to be overwriting the same line so I think a new line command somewhere. Also os it posible to get the code to append to the list...
  3. N

    Change sheetname, file name and range by cell value

    Public Sub DATA_noibang()Dim cn As Object, rs As Object, i As Byte, lr As Long, fso As Object Set cn = CreateObject("adodb.connection") Set fso = CreateObject("Scripting.FileSystemObject") Sheets("noibang").AutoFilterMode = False...
  4. M

    vba Read Text file and update in Different Column...

    Hi Team I have textfile with data in it as shown below , my task is to seperate below data in ColumnsSeperation Criteria is *---------So in Below situation Data should get populated in Column A,B,C.Thanks in advance. xxxxxxxx*--------------yyyyyyyy*--------------zzzzzzzz My attempted Code. with...
  5. A

    Filename with double quotes in the name

    I am checking for file size on files before I process them. I am trying to get information on a text file which has double quotes as part of it's name. The path and filename is saved in a table. I get an error msg(error 53: file not found....) and I can't figure out how to get around it. Here...
  6. R

    Left align the table in Mail using VBA

    Hi Team, I am stuck in one scenario where I want to left align the table in Mail. I did this kind of automation in past and this align perefectly but don’t know what I am doing wrong on below code or can anyone have any other solution. Function RangetoHTML(rng As Range) ' By Ron de Bruin...
  7. W

    Check if file exists. Keeps skipping the existing file.

    Hi. So, i got a code for checking if a file exists from google. The problem is with it, even tho the file actually exists, it keep skipping it, as it didn't exists. Code: Sub CFF() Dim fso: Set fso = CreateObject("Scripting.FileSystemObject") If fso.FileExists("Desktop\SkjKa.xlsm") Then...
  8. T

    File System Object late binding

    This code works in early binding: Dim fso As Scripting.FileSysemObject Set fso = New Scripting.FileSystemObject Dim MyFolder As Folder Set MyFolder = fso.GetFolder("C:\MyData") Dim Num As Integer Num = MyFolder.Files.Count To change to late binding, how do I declare MyFolder? For...
  9. P

    Excel 2016 issue saving to HTML format

    With Excel 2010 I had no problem populating and saving a Word template of a metric comprised of various charts, shapes, tables etc. to a .png file. This facility's monitors require image files and they were essentially a screen shot of the document. But when I upgraded to Office 2016 this week...
  10. B

    vba code-copy files from folder and sub folders

    hi everyone, I now its a mainstream thing that I am writing now in fso systems but I am trying to learn "how I would do that" thing, can you please help with the below code? It does not give any error message or something but it is not copying any materials to destination. Sub...
  11. S

    VBA CreateObject() not working in 2016 x64

    I'm using the GetBoiler function by Ron de Bruin to grab an Outlook signature for an email VBA function. This function has historically worked perfectly in 2013 x64, however I have recently been upgraded by my organization to 2016 x64, and the CreateObject() command now throws error 429 ActiveX...
  12. Z

    Any tips on how to modify this VBA to select all sheets in a workbook?

    This is some VBA from another thread here that would be very helpful to me if it were able to select all sheets in a workbook. I didnt want to hijack the other thread with this question so I posted a new thread. Any help would be appreciated. Private Sub test() Dim fso As Object, FolDir As...
  13. M

    Check if a folder exists but with a variable name?

    Afternoon all, Im trying to create a code that will automatically check for the correct monthly folder and if it doesnt exist it would create it. As it will change every month I would like to use a variable method but I keep getting an error. Sub FindFolder() Dim fso As Object Const...
  14. E

    Need to copy Worksheets from a file choosen in a ListBox

    Hi, I need to get further with this assignment. With this code I've found a given data file in my ListBox with search in the folder of my main workbook location: Public Sub UserForm_Activate() Dim fso As FileSystemObject Dim dir As Folder Dim file As file Set fso = New...
  15. D

    Using FSO

    Hi, I am using FSO in the following way to read the content of 2 files into 2 string variables. Is this correct or can I create a FSO just once and read both files into separate variables in the same code block? Also when writing data to a file is complete the file is normally closed. Can I...
  16. 3

    Run-time Error 424

    Hi, I have the following code but I got the error message saying that "Run-Time Error 424, Object Required". Wonder if someone could point out what the cause is, and how to rectify? Sub callCFP() pathName = "C:\Code\subFolder_1" Set fso = CreateObject("Scripting.FileSystemObject")...
  17. R

    Object required error

    Dim fso As Object Dim dir As Object Dim file As Object Dim rangews As Worksheet Dim fPath As String fPath = "censored" Set rangews = ThisWorkbook.Worksheets("Sheet1") Set fso = CreateObject("Scripting.FileSystemObject") Set dir = fso.GetExtensionName(fPath) line set dir =.... gives me...
  18. S

    Looping through all files in all subfolders within selected directory

    I have a set of code written to update some cells in a number of excel files that all share the same general format. I am able to get this code to work on all files within a folder but we literally have a directory of hundreds of subfolders organizing our files. I need to be able to loop...
  19. E

    How Can I Only Open Text (.txt) Files When Working With FSO? (FileSystemObject)

    Currently have a working script that uses FSO, but it also opens .xlsm files within my working directory. I would like to to only open .txt files. I found this code that should work, however I can't figure out how to apply it to my situation: Sub test() ' Loop thru all files in the folder...
  20. P

    How can I use Inputbox to get a file Path ?

    【Question#1】 Suppose I create a Excel File to get other ten file record together by a folder. I want user dynamic to give Excel file a path by some method. The first thinking jump out my mine is via inputbox. but I try several time , application.inputbox("Pls paste a file path !", type:=2) ...

Some videos you may like

This Week's Hot Topics

Top