Forum     

Go Back   Digit Technology Discussion Forum > Software > Programming
Register FAQ Calendar Mark Forums Read

Programming The destination for developers - C, C++, Java, Python and the lot


Reply
 
LinkBack Thread Tools Display Modes
Old 08-09-2011, 01:34 PM   #1 (permalink)
In The Zone
 
arian29's Avatar
 
Join Date: Feb 2008
Location: New Delhi
Posts: 212
Arrow need help with VBA


I need a code in vba which would read a file name in a specified folder (dynamic path). the file name changes every time and there can be more than one files and the code should pick them all. The file is recognised by a word say "QWE" which exists in the file name everytime. e.g. E2 QWE T556M.XLSX etc...
__________________
http://www.twitter.com/arian29
ScAn My AvAtAr
arian29 is offline   Reply With Quote
Advertisements. Register and be a member of the community to get rid of them.
Advertisement

Old 08-09-2011, 04:12 PM   #2 (permalink)
Super Moderator
 
asingh's Avatar
 
Join Date: May 2008
Location: New Delhi
Posts: 5,548
Default Re: need help with VBA

Quote:
Sub Open_Files()
'//files are opened from here...and processed for raw data

Dim crnt_prj_pth As String
Dim fl_nm As String

fl_nm = Dir(crnt_prj_pth & "\" & "*.CSV") '//.CSV wildcard is being used here


Do While fl_nm <> "" '//master LOOP

'//intermediate processing

fl_nm = Dir

Loop

End Sub
This will cycle through the directory path which you assign to the variable "crnt_prj_pth".
__________________
MSI P45 Platinum(BIOS v1.7B)|Q9550[E0]@3.85Ghz@1.320V[453x8.5]MCH@1.184V|ICH@1.55V|DDR_V_Ref_A_B@1.05V|NH-D14|Corsair TWIN2X4096-8500C5(5-5-5-15)@1089Mhz@2.14V
2xHD4890[Xfire]@1000/900[MEM/GPU]|Corsair 650TX|Seagate180GB+80GB+WD1TB|SONY-DVD-R|CM690|2x120mm Scythe Ultra Kaze|DELL S2409W|APC 1100VA|Scythe Kaze Server
Windows 7 Ultimate RTM - 64BIT|Catalyst 10.5 (8.14.10.0753) forced with RadeonPRO|PS3 160GB|Sony 40EX520|AC Ryan POHD Mini|APC 800VA|APC 800VA|D425KT|CM100 Elite|2TB WD|Acer D255

Test your spoiler tags before submitting
asingh is online now   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


 
Latest Threads
- by Charan
- by Sarath
- by clmlbx

Advertisement




All times are GMT +5.5. The time now is 12:34 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.

Search Engine Optimization by vBSEO 3.3.2