Paste clipboard contents to a text file after being prompted for a name for the file?

Event2020

Board Regular
Joined
Jan 6, 2011
Messages
122
Office Version
  1. 2019
Platform
  1. Windows
I have a macro that copies certain information to the clipboard which works perfectly.

This is where I need help.
I need to be able to copy/paste the clipboard to a text file and it would be better if I am prompted for a location/directory in which to create the text file and for a name for the text file.

The ultimate for me would be if the text files extension (.txt) could be changed to .html (but the file has to still be a text file) although this is more of a wish list than a need.

The steps I imagine to achieve this would be something like...
1. Run the macro that pulls the data from various worksheets and copies it to the clipboard.
2. Excel prompts me for a location/directory in which to create the text file.
3. Excel prompts me for a name for the text file.
4. Excel creates the text file, copies the contents of the clip board into the file and save it using the information from Step 2 and Step 3.
5. Excel changes the text files extension from .txt to .html

I know this may be a lot to ask but it is way over my head.

Thanks in advance
 

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
Did you want to just put plain text into an htm/html file?

If you want to convert a range to html, see:
'https://www.rondebruin.nl/win/s1/outlook/bmail2.htm
Function RangetoHTML(rng As Range)

In that function, you can see how the text file was created. If you want a prompt for the filename, one method is Application.GetOpenFilename.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,178
Members
453,021
Latest member
Justyna P

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