+ Reply to Thread
Results 1 to 3 of 3

Wrestling with this VBA code

  1. #1
    Forum Contributor
    Join Date
    05-09-2005
    Location
    SC
    Posts
    196

    Wrestling with this VBA code

    Hello Leith (or any other Programmer); I'm coming back at you from the East Coast.

    Sub Test()
    Activesheet.Copy
    Range("B1").NumberFormat = "mm-dd-yyyy"
    ActiveWorkbook.SaveAs FileName:="c:\ArchiveFolder " & Range("B1") & ".xls", FileFormat:=xllWorkbookNormal
    ActiveWorkbook.Close
    End Sub


    Error 400??? I looked at my program, and I do have 4 userforms that are all connected to checkbox & option box objects. They all pop up when the workbook is first opened, which I need to happen.

    Another alternative...

    I tried this other code which does work, however it saves it as test, which it should because this is the way it's programmed; however...

    How do I do a SaveAS filename that is located in cell "C1" on the worksheet?
    Everytime the user hits the archive button, it must be saved with the current date, which I have as =today() in cell "C1"


    Sub test()
    ActiveSheet.Copy
    ActiveWorkbook.SaveAs Filename:="C:\ArchiveTestFolder\test.xls"
    ActiveWorkbook.Close
    End Sub


    Thanks,
    EMoe

  2. #2
    Forum Contributor
    Join Date
    11-09-2004
    Posts
    451
    Sub test()
    t = Format(Range("c1").Value, "mm-dd-yyyy")
    ActiveSheet.Copy
    ActiveWorkbook.SaveAs Filename:="C:\ArchiveTestFolder\" & t & ".xls"
    ActiveWorkbook.Close
    End Sub

  3. #3
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259
    Hello EMoe,

    I was going to post what Anilsolipuram posted.

    Sincerely,
    Leith Ross

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1