+ Reply to Thread
Results 1 to 3 of 3

Save File Issue

  1. #1
    Registered User
    Join Date
    12-06-2013
    Location
    sauk rapids, mn
    MS-Off Ver
    Excel 2003
    Posts
    7

    Save File Issue

    Can someone tell me what I am doing wrong in the save file code.
    I want the code to save to the file below by year automatically.
    The save file does partially work.
    I’m getting run time error 1004
    Method ‘Save as’ object ‘_workbook’ failed

    Old code
    "I:\DOCUMENT_LIBRARY\ISO 9001 QMS\Quality Control\Records\Calibration\Calibration fiscal year 2015
    ActiveWorkbook.SaveAs Filename:= _
    "I:\DOCUMENT_LIBRARY\ISO 9001 QMS\Quality Control\Records\Calibration\Calibration fiscal year 2015\Master Calibration Rev 04 Year 2015.xlsx" _
    , FileFormat:=xlOpenXMLWorkbook, CreateBackup:=False

    Sub () SAVEFILE
    a = Year((Now))
    ChDir _
    "I:\DOCUMENT_LIBRARY\ISO 9001 QMS\Quality Control\Records\Calibration\Calibration fiscal year " & a
    ActiveWorkbook.SaveAs Filename:= _
    "I:\DOCUMENT_LIBRARY\ISO 9001 QMS\Quality Control\Records\Calibration\Calibration fiscal year & a\Master Calibration Rev 04 Year & a.xlsx" _
    , FileFormat:=xlOpenXMLWorkbook, CreateBackup:=False
    Sub end
    Thanks for the help

  2. #2
    Forum Expert Kenneth Hobson's Avatar
    Join Date
    02-05-2007
    Location
    Tecumseh, OK
    MS-Off Ver
    Office 365, Win10Home
    Posts
    2,573

    Re: Save File Issue

    You have several issues there. The main thing is that when you are building a string, it is best to see what it builds to. Obviously, incorrect syntax will show even before you Compile.

    You can use Debug.Print to put a run's result into VBE's Immediate Window to see the result.
    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    12-06-2013
    Location
    sauk rapids, mn
    MS-Off Ver
    Excel 2003
    Posts
    7

    Re: Save File Issue

    Thanks for all the help

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Macro needed to open "File Save As" and change save file type
    By blainerhett in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-28-2014, 02:40 PM
  2. [SOLVED] file Save As issue
    By rdowney79 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 11-06-2013, 04:52 PM
  3. Replies: 1
    Last Post: 09-05-2013, 02:39 PM
  4. Replies: 1
    Last Post: 08-29-2013, 07:29 AM
  5. [SOLVED] Save worksheet as seperate workbook problem- File name issue
    By ANDREWA in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-24-2012, 07:16 AM
  6. File save count issue
    By biznez in forum Excel General
    Replies: 6
    Last Post: 12-15-2009, 10:59 AM
  7. Replies: 0
    Last Post: 03-09-2005, 06:06 PM

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