Copy and Paste from Excel to Notepad, then Save with Specific Filename

mataxu

New Member
Joined
Jun 15, 2015
Messages
1
Hi! I'm working on a program in VBA that requires copying and pasting from Excel to Notepad, and I could use a little help.

In another method in the same worksheet, a program automatically generates the contents of a sheet, x amount of cells at a time (it's not fixed, it's based on user input). What I want to do is:

1) Copy the selection that just got added to the randomly generated sheet
2) Open Notepad
3) Paste contents into Notepad
4) Save file as the date in the format "ddmmyyyy" + " PROG", so for instance today it would be like "15062015 PROG". Also it needs to be saved in the format .csv. Thanks!!

What I was thinking so far was along the following lines:

Code:
Sub CopytoNotepad()

Range(Cells(1,1),Cells(1,x)).Copy
Shell "Notepad.exe", vbNormalFocus
Sendkeys "^V"

EndSub

But this doesn't really allow me to automatically generate the name or anything.
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.

Forum statistics

Threads
1,223,228
Messages
6,170,871
Members
452,363
Latest member
merico17

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