![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
New Member
Join Date: Apr 2002
Posts: 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 |
|
|
|
|
|
#2 |
|
MrExcel MVP
Join Date: Mar 2002
Location: Chicago, IL USA
Posts: 2,042
|
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 |
|
|
|
|
|
#3 |
|
New Member
Join Date: Apr 2002
Posts: 4
|
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 |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|