Need help on VB code

SKV

Active Member
Joined
Jan 7, 2009
Messages
255
Hi - I have to upload a lot of files in my system for some simulation. I am very new to VB code so looking for help.

1) I have 20 files in a folder and all named as Day1, day2, day3.... I need a VB code which upload these files 1 by 1 and also run some macros (mac1, mac2 etc) each time the new files is uploaded

2)In my current system, I use the Now() to record the day the file was uploaded. Since my simulation is based on this day. I want the above code to manipulate the date - It can have for day1 as Jan1, day Jan2 etc

Please guide
 

Some videos you may like

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"

SKV

Active Member
Joined
Jan 7, 2009
Messages
255
Hi - I have to upload a lot of files in my system for some simulation. I am very new to VB code so looking for help.

1) I have 20 files in a folder and all named as Day1, day2, day3.... I need a VB code which upload these files 1 by 1 and also run some macros (mac1, mac2 etc) each time the new files is uploaded

2)In my current system, I use the Now() to record the day the file was uploaded. Since my simulation is based on this day. I want the above code to manipulate the date - It can have for day1 as Jan1, day Jan2 etc

Please guide

Please help immediately
 

revver

Active Member
Joined
Dec 20, 2007
Messages
251
I presume that by 'upload' you mean 'import'.

If that is so, your tables will need to correspond with the structure of the text files. Given that your receiving structures are suitable you could use logic like:

Code:
For fileDay = 1 to 20
   Open filename for input as #33
   parse the input data and set fields into the table
   close file
Next
Now run your macros
HTH
 

Watch MrExcel Video

Forum statistics

Threads
1,122,709
Messages
5,597,697
Members
414,164
Latest member
ARTW

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
Top