Excel Vba Error 1004 Document Not Saved
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn run time error 1004 document not saved more about Stack Overflow the company Business Learn more about hiring developers or posting
Excel 2010 Vba Run Time Error 1004 Document Not Saved
ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack excel vba runtime error 1004 document not saved Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Runtime error 1004 Document not saved when try to save file excel vba error 1004 sort reference not valid with date in filename up vote 2 down vote favorite So I have a macro which work perfectly fine as it is below. It loops through a data validation drop-down and saves a pdf for each country in dropdown. However when I try to edit the macro so that the filename includes the date in addition to the country name (D14) I encounter the runtime error 1004 Document
Excel Vba Error 1004 Pivot Table Field Name Is Not Valid
could not be saved. I am very new to VBA so I have no idea how to solve this...I would really really appreciate some help Steph Sub Create_PDFs() ' ' Create_PDFS Macro ' ' Keyboard Shortcut: Ctrl+y ' Const sheetToExportName = "Graphs" Const sheetWithCountryList = "Master Sheet" Const CountryListAddress = "AQ6:AQ38" Const chosenCountryCell = "D14" Const sheetWithChosenCell = "Graphs" Dim CountryList As Range Dim anyCountry As Range Set CountryList = _ ThisWorkbook.Worksheets(sheetWithCountryList). _ Range(CountryListAddress) For Each anyCountry In CountryList ThisWorkbook.Worksheets(sheetWithChosenCell). _ Range(chosenCountryCell) = anyCountry ThisWorkbook.Worksheets(sheetToExportName).ExportAsFixedFormat Type:=xlTypePDF, Filename:= _ "N:\International Finance Division\RAT Advanced Economies - Chartpacks\Country Risks\Created PDFs\" & ActiveSheet.Range("D14").Value & " - Country Risk Indicators.pdf" _ , Quality:=xlQualityStandard, IncludeDocProperties:=False, _ IgnorePrintAreas:=False, OpenAfterPublish:=False Next Set CountryList = Nothing End Sub excel excel-vba save runtime-error share|improve this question edited Jul 8 '14 at 17:28 tannman357 355113 asked Aug 19 '12 at 15:36 user1610138 1112 2 Does the value of D14 contain date with "/" character? If that is, the file name must not have special characters such as :, / etc. –shahkalpesh Aug 19 '12 at 15:39 add a comment| 1 Answer 1 active oldest votes up vote 0 down vote Clean the value of your date of special characters. Assuming that range will alwa
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies excel vba error 1004 application-defined or object-defined error of this site About Us Learn more about Stack Overflow the company excel vba error 1004 select method of range class failed Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges
Excel Vba Error 1004 Method Range Of Object _global Failed
Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: http://stackoverflow.com/questions/12027718/runtime-error-1004-document-not-saved-when-try-to-save-file-with-date-in-filenam Sign up VBA - Runtime Error 1004 - Document Could Not Be Saved up vote 2 down vote favorite 1 The actual error I'm getting is "Run-time error '1004': Document not saved." and then when I hit debug it takes me to the line ActiveWorkbook.Save I've got a giant VBA macro that I'm having some problems with. The macro is started in http://stackoverflow.com/questions/11157127/vba-runtime-error-1004-document-could-not-be-saved a giant workbook with ~75 or so sheets of data. It starts at the first page, reads the name of the Worksheet to determine which model to run on the data, creates a new workbook, does the calculations and creates the graphs, and then saves the workbook before moving on to the next input sheet. All of this works fine, except for saving the new workbook. There are 4 different models I'm running, and 2 of them save correctly. However, for the other 2 I am faced with this error anytime I try and save them. OutputFolder = "location of output file" If Dir(OutputFolder, vbDirectory) = "" Then MkDir OutputFolder End If Workbooks.Open Filename:="location of input file" '(this is a path to the file) Workbooks.Open Filename:="location of lookup table" '(another path) number_of_reports = Workbooks(InputFile).Sheets.Count Workbooks(InputFile).Activate For i = 1 To number_of_reports ReportID = ActiveSheet.Name 'get 3 part ID ID_Lookup = Split(ActiveSheet.Name, "-") 'seperate into individual parts Workbooks("LookupTable").Activate 'use lookup table Sheets("CompanyLookup").Select CompanyID = Range("A" & (ID_Lookup(0) + 1)) CompanyName = Range("B" & (ID_Lookup(0) + 1)) Sheets("CategoryLookup").Select CategoryID = Range("A" & (ID_Lookup(1) + 1)) CategoryName
Forum Microsoft Office Application Help - Excel Help forum Excel Programming / VBA / Macros Run-time error 1004 Document not saved.... To get http://www.excelforum.com/showthread.php?t=1018539 replies by our experts at nominal charges, follow this link to buy points and post your thread in our Commercial Services forum! Here is the FAQ for this forum. + Reply to Thread Results 1 to 4 of 4 Run-time error 1004 Document not saved.... Thread Tools Show Printable Version Subscribe to this Thread… Rate This error 1004 Thread Current Rating Excellent Good Average Bad Terrible Display Linear Mode Switch to Hybrid Mode Switch to Threaded Mode 06-17-2014,08:51 AM #1 ey_up View Profile View Forum Posts Registered User Join Date 05-19-2014 Posts 10 Run-time error 1004 Document not saved.... Hi all, I am running the Macro below to export to excel vba error pdf a document. It has worked perfectly for over a week up until today and I am not sure why I am now getting the error message. It appears that it wont save the pdf at all as the pdf file does not get created or shown on screen. My complete macro is actually three modules, copy data to another excel sheet, print sheet and then export copy to pdf. Code as follows: Module 1 Please Login or Register to view this content. Module 2 Please Login or Register to view this content. Module 3 Please Login or Register to view this content. Module 4 Please Login or Register to view this content. The error message I get today is Run-time error 1004: Document not saved. The document may be open, or an error may have been encountered when saving. Please could somebody offer me an explanation as to why this has suddenly started hap