+ Reply to Thread
Results 1 to 2 of 2

Macro uses "Save As" to a specific location

  1. #1
    kyle
    Guest

    Macro uses "Save As" to a specific location

    I have a save as part written in my code and I want it to save to a specific
    folder (Lab_Inspection_Data in My Documents). However, the way I have it
    written right now does not work. Could someone show me how to write the code
    so it saves in the correct folder? Here is my code...

    sFilename = Format(Worksheets("Checklist").Range("H4").Value & "_" &
    Worksheets("Checklist").Range("B4").Value, "yyyy-mm-dd")
    ans = MsgBox("Save file as " & sFilename)
    If ans = vbOK Then
    ActiveWorkbook.SaveAs "C:\My Documents\Lab_Inspection_Data\" & sFilename
    End If

    Thanks,
    Kyle

  2. #2
    Jim Jackson
    Guest

    RE: Macro uses "Save As" to a specific location

    ActiveWorkbook.SaveAs "C:\My Documents\Lab_Inspection_Data\" & sFilename &
    ".xls"

    If I am reading your code accurately, the required ".xls" is missing.

    --
    Best wishes,

    Jim


    "kyle" wrote:

    > I have a save as part written in my code and I want it to save to a specific
    > folder (Lab_Inspection_Data in My Documents). However, the way I have it
    > written right now does not work. Could someone show me how to write the code
    > so it saves in the correct folder? Here is my code...
    >
    > sFilename = Format(Worksheets("Checklist").Range("H4").Value & "_" &
    > Worksheets("Checklist").Range("B4").Value, "yyyy-mm-dd")
    > ans = MsgBox("Save file as " & sFilename)
    > If ans = vbOK Then
    > ActiveWorkbook.SaveAs "C:\My Documents\Lab_Inspection_Data\" & sFilename
    > End If
    >
    > Thanks,
    > Kyle


+ 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