![]() |
|
#1
|
|||
|
|||
![]() Code:
Dim FSO As New FileSystemObject Private Sub Command1_Click() Dim fld As Folder Dim flds As Folders Dim fl As File With FSO Set fld = .GetFolder("D:\Projects Others\TZ-HASAN\WEB\images_upload") Dim f 'MsgBox fld.Files.Count For Each fl In fld.Files If Right(fl.Name, 3) = "img" Then fl.Name = Left(fl.Name, Len(fl.Name) - 3) & "gif" End If Next End With End Sub |
#2
|
||||
|
||||
![]()
Excel is complaining that it does not know what a FileSystemObject is. To use FileSystemObject you have to use a special reference which tells Excel where it can find out what FileSystemObject is.
Code:
Private Sub Command1_Click() Dim FSO As FileSystemObject Dim fld As Folder Dim flds As Folders Dim fl As File Set FSO = New FileSystemObject With FSO Set fld = .GetFolder("D:\Projects Others\TZ-HASAN\WEB\images_upload") 'MsgBox fld.Files.Count For Each fl In fld.Files If Right(fl.Name, 3) = "img" Then fl.Name = Left(fl.Name, Len(fl.Name) - 3) & "gif" End If Next End With End Sub |
#3
|
|||
|
|||
![]()
Hi, I had the same issue and your guidance resolved it. Thanks
|
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
Manit | Excel Programming | 4 | 12-08-2011 07:35 PM |
Edit Multiple Emails' User-Defined Field | ryancaseymcshane | Outlook | 0 | 10-04-2011 07:40 AM |
Compile error: sub or function not defined.. | xena2305 | Excel Programming | 0 | 08-02-2011 10:17 AM |
![]() |
noufalcm | Word | 1 | 03-08-2011 01:46 PM |
![]() |
J_oe | Word | 1 | 02-17-2011 10:55 AM |