VBA question (creating a file)

tomch

New Member
Joined
Jul 30, 2018
Messages
1
I am new to this.
I need a simple VBA program that does the following:



The EXCEL document is in the same folder as a bunch ofprograms.
If you select all these programs and drop them onto theexcel document, it should come up up with a pop up window asking for a filename.
After you enter a file name (123456 orwhatever you enter) it then should create a new file with that name withexactly that name.

The file should contain a header (as specified under headerin the excel document)
Followed by the list of all the program names that wheredropped into the document with a preceding expression “M198”
And finally a footer section as specified under footer inthe excel document.

So if my excel document specifies:
Header:
This
Is
A test

End header



Footer

Thank
You

End footer



And I highlight and drop the following files into thedocument (max 50):

4520

4521
4522

4523

4524



New a window has to appear asking for a file name…
And let’s say I enter
565656



I should end up with a new file called 565656 in the samefolder as all the other files.


The file itself should contain the following (in simpleASCII format):
This
Is
A test

M198 4520
M198 4521
M198 4522
M198 4523
M198 4524
Thank
You

Please note that all the entries under M198 have to be alphanumerically sorted…

 

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.

Forum statistics

Threads
1,215,054
Messages
6,122,895
Members
449,097
Latest member
dbomb1414

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
Back
Top