different save name in notepad

Dennis

New Member
Joined
Apr 27, 2002
Messages
4
Hey I need a macro, which will change the save name of a document in notepad each time the macro is run so the previous save wont be delected. I would want to add this macro to another macro, which collects information from an excel sheet and paste's them onto a notepad sheet.

Thanks

Dennis
 

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
Hi,

From your other thread, add a prompt to get the name you want to use.

Dim x as string
x = Application.InputBox("Filename?")
x = x & ".txt"
ActiveWorkbook.SaveAs x, FileFormat:=xlText

This might allow you achieve what you want.

If you are going to run this multiple times per session, add a counter and increment it on each pass. Then save the file as

name_of_file = "sample" & counter & ".txt"

for instance. Then do csomething like:

ActiveWorkbook.SaveAs name_of_file, FileFormat:=xlText

HTH,
Jay
 
Upvote 0
ok so this is the macro so far
ActiveWorkbook.SaveAs "sample.txt", FileFormat:=xlCSV

Range("B1:B20").Select
Selection.Copy
Range("C19").Select
End Sub

How would I put you told me with that?

Thanks
Dennis
 
Upvote 0

Forum statistics

Threads
1,213,526
Messages
6,114,136
Members
448,551
Latest member
Sienna de Souza

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