VBA: Open notepad, paste array but don't save to disk

milkoholic

Board Regular
Joined
Jul 21, 2010
Messages
61
Hi,

I've found this code snippet:
Code:
Dim RetVal
RetVal = Shell("C:\WINDOWS\notepad.exe", 1)
And it opens up an untitled notepad document.

The thing I would like to do is to paste the values of an array into this document.
I've googled a bit and all I can find is ways to do this if you save the notepad file somewhere on the computer first.
This is something I don't want to do. I just want it to be open and unsaved, but be able to paste the values of my array there.

Is this possible, or does it have to be saved to disk before you can interact with it?

Regards,
milko
 

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
My approach is usually to write the data to a disk file in the user's TEMP directory and then open it in Notepad. It can be deleted from TEMP if necessary.

Windows is writing to TEMP all the time - another file won't make much difference.

The alternative is to use SENDKEYS which relies on the user not touching the keyboard until the process has been completed. It's not a very robust solution.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,516
Messages
6,119,980
Members
448,934
Latest member
audette89

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