Error Checking in Excel
Thanks Thanks:  0
Likes Likes:  0
Results 1 to 3 of 3

Thread: different save name in notepad

  1. #1
    New Member
    Join Date
    Apr 2002
    Posts
    4
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    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. #2
    MrExcel MVP Jay Petrulis's Avatar
    Join Date
    Mar 2002
    Location
    Chicago, IL USA
    Posts
    2,040
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    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. #3
    New Member
    Join Date
    Apr 2002
    Posts
    4
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    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

Some videos you may like

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •