VBA Macro To Save File2 If File1 Saved

Apr 22, 2014

I have two excel file:

C:Book1.xls
C:Book2.xls

I am looking vba to do the following:

Whenever I do Save for Book1, I want Book2 to auto save without prompt.

View 13 Replies


ADVERTISEMENT

Macro To Check If Saved Then Save Else Bring Up Save As Dialog

Sep 6, 2012

I'm trying to make a macro check if a file has been saved (ever). If so I want the macro to do a regular save (with already esatablished filename and location) before it proceeds with the rest of the macro. If the file hasnt been saved (if it runs from a new workbook) then I want it to pop up the save.as dialog, so that the user can choose the name and location of the file before the macro continues .

The macro itself is saved in personal.xlsx.

View 1 Replies View Related

Excel 2010 :: Save As PDF - Document Not Saved

Apr 12, 2013

I have an Excel 2010 spreadsheet which I need to print to PDF. There is a simple "Save as" PDF option which always fails with just the message "Document not saved". I created a simple test sheet with just a few numbers on to check it isn't due to complexities with the particular workbook. This works on my home PC (Windows 7) but not on the Windows 7 Club PC which is where I need to run it to generate the output which eventually will go to the club's website.

It also fails the same way if I try to create an XPS file (although I don't want an XPS file).

This fails from the normal user interface "Save As". I also tried it from a VBA macro and run it: I get Run-time error '-2147467261 (80004003)' Document not saved

I've googled endlessly but all the references I tried failed to uncover a solution. I was a bit surprised that this doesn't seem particularly common and most of the reports seem to be a couple of years old or older (no workarounds were useful).

View 1 Replies View Related

Save Column J Of WorkBook When WorkBook Is Not Saved.

May 27, 2006

Need VBA code to save column J of open workbook called LmbcAcctsPayable.xls, Sheet1, to same workbook & sheet called LmbcAcctsPayable.xls, Sheet1, when save is not selected.

Reason: The workbook is usually not saved because it is more of a templet with names in column A. Column J is updated with a date when a row is used so I need the column J to copy automatically to the blank templet when exiting without saving (using ThisWorkbook.Save = True in Auto_Close). That way, rows not being used for a long period of time can be periodically eleminated.

View 3 Replies View Related

VBA Macro To Tell Who Last Saved A File

Oct 10, 2002

Macro (saved on the workbook not in the Personal macro file) which should give the following info (lets say on sheet 1, starting A1, A2) who last saved that file and the date.

View 9 Replies View Related

Macro To Show That Workbook Has Been Saved

Nov 25, 2009

I have a workbook that I constantly am improving with new macros and VB routines. I sometimes have two versions available for use at the same time. I would like to create a macro or routine that will tell me if the workbook has been saved. A simple cell color change to indicate I've saved would be fine. Also, if I DO save the file and the cell color changes to indicate I have saved, I would like the cell color to change back if any change is made to the workbook. This way I will always know if I need to save or not to keep latest changes.

View 3 Replies View Related

Macro That Starts When The File Gets Saved

Oct 19, 2009

I found this for my problem (creating a macro that starts when the file gets saved): Private Sub App_WorkbookBeforeSave()

I tried to use it, but the macro didn't do anything when I saved the file.

View 9 Replies View Related

Macro Opening Latest Saved File

Aug 1, 2014

I'm using a macro to open an other excel file to get data from it. this goes by Workbooks.Open Filename:=totalopen (totalopen =Filepath & filename earlier defined) Because the opening file can have the same filename, my question; is it possible to open the latest/newest saved file? So also look at the saving date/time of opening excel file.

View 5 Replies View Related

Disable Macro In Workbook Open When Saved

Nov 17, 2011

I have a macro in a workbook template,that when the workbook is open it populates a cell with the date and time such as 111711.507. This becomes the contract number for this workbook.. They complete the form or workbook and save it. The next time they open the saved workbook the macro runs and changes the contract number to a new number. I want to disable the macro on the saved workbook from changing the number.

View 2 Replies View Related

Mail Macro - Attach Saved PDF File To Email

Nov 21, 2013

I have written a macro but unable to make it work. The macro works but not the way I would like it to.

The macro has to save an excel sheet to a separate folder as a pdf format, a message box should pop up confirming the pdf file and then attach the same saved pdf file to an email.

Now the macro saves the pdf file where I need it to be saved, the msg box pop up and then the pdf file opens up on top of the msg box. If I close the pdf file the msg box which was hidden under the file is now shown. When I click "OK" it goes straight to outlook with the email addresses attached but the saved pdf file is not attached.

I've attached the script.

Sub Macro1()
'
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:="C:UserReportsPDF Reports" & Range("Q3").Value _
, Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas _
:=False, OpenAfterPublish:=True

[Code] ........

View 8 Replies View Related

Excel 2010 :: Multiple CSV Files - Macro To Point Folder Where These Saved

May 11, 2012

I'm working on a project where I need to import 150 csv files into an Excel2010 workbook, with each csv file being on a seperate worksheet.

I would like to set up a macro to point to the folder I will have these saved in this up so that each month when I get updated csv files I can repeat the process and bring in the new data. how to create this, I'm very new to VBA?

View 1 Replies View Related

Save As Macro (macro That Opens The Save As Window)

Oct 22, 2008

I'm trying to have a macro that opens the save as window, places the name in cell f5 and then allows you to save the workbook with cell f5 as the filename. I have managed to get the save as window to come up and the cell f5 as the name, but when I press save is doesn't. Here is what I have (also, is there a way to direct this to a specific folder).

View 4 Replies View Related

Save As Macro :: Save File To Folder

Jan 17, 2010

I have a macro that copy one sheet of the Active workbook and sends it via email.

I need to add a code in this sheet so when one opens it from the email, with a command button to be able to save the file to specific, fixed folder on the local network with it’s original file name.

View 10 Replies View Related

Macro To Save, Save As With Sequential Name

Feb 5, 2007

My spreadsheet has 32 worksheets, I've recorded a macro to do the job "save, save as with specific name", but what I want is, when save as, I wanted the file name increase in one number, and the date in a specific range "H8:J8" the date should be the next saturday.

here is part of the code.

Range("D11:J65").Select
Selection.ClearContents
Range("J44").Select
Sheets("NsFri").Select
ActiveWindow.SmallScroll Down:=-12
Range("A12:A21,D12:I21").Select

on this example I want the file saved as "PrA4W05.xls", being the next week "PrA4W06.xls", and so on.
and on "H8:J8" the next saturday.

View 9 Replies View Related

Macro: Show A Message Box Instead That Says "File Not Saved!"

Feb 17, 2010

I use the following macro to save my worksheet. However, if I click cancel when the save box is open, then I am presented with an error. How do I get it to skip the error and show a message box instead that says "File not Saved!".

View 2 Replies View Related

Macro To Open File Saved In Same Location But File Name Changes With Each Date

Feb 8, 2013

I do routine tasks every day which involves opening 3 different files and pasting data into my main file. The data is always in the same format, and the 3 files are saved in the same location (3 different folders through). The 3 files are saved each day and the naming convention is constant, with only the date changing. For example, the files are always saved in C:My Documents and the files are called test_05.02.2013.xls. Tomorrow the file will be called test_06.02.2013.xls and so on.

So each day I will be rolling a file forward and I want to bring in the info from each of these files based on the new day.

How to do 1, and I will do the others (because the concept will be the same).

View 1 Replies View Related

Macro To Save File - Save Name From Cell Containing Date Using Different Date Formatting

Aug 15, 2014

I am trying to create a macro to run from a form button, within a report, to save a file to a variable file path and name depending on the date value in cell B5.

The format of B5 looks like - 13/08/2014 16:39

The file path has folders for each year in format "yyyy" with each year having sub folders for each month in format "mm".

The file name is just the date only and is formatted "dd.mm.yy" e.g. 13.08.14

I have tried the code below in various permutations but always end up with an error - Method 'SaveAs' of object '_Workbook' failed.

[Code] ......

View 3 Replies View Related

Conflict Between Auto Save&close Macro And Show/hide Sheets Macro

Oct 16, 2009

I am trying to make a save&close workbook macro.

I found several examples on google, but unfortunatly it conflicts with another macro I use for forceing users to enable macros (hide all sheets except one if macros are disabled).

The attached file is an example contaning the save&close code and the show/hide sheets depending on macros enabled.

If the file is opened with macros disabled then only one sheet will be visible.
If the file is opened with macros enabled other sheets are visible.

The problem if that this code uses a custom save, witch makes the save&close not save... (in module1 and in ThisWorkbook)

The pourpose of the save&close is to make sure some users don't forget the excel open and thus block access to it. So if a certain idele time passes excel has to save and close without any confirmation messages.

View 10 Replies View Related

Macro To Save As PDF?

Nov 30, 2011

I have a macro that saves each sheet of my workbook to PDF's. I have a macro that runs prior to the save macro that filters each sheet and hides rows I do not need printed.

I simply use a formula to show a 1 in column H.

What I would like to do is sum let's say rows 5:58 and it H59 is below let's say 5 that sheet is not saved as a PDF.

I looked for awhile for a if.then macro that might solve my question, did not see anything that fit.

View 2 Replies View Related

Macro For 'Save As'

Nov 14, 2006

I want to specify a button that have the function of prompting the user to save the file as new file name. I tried to do the record macro, but I think it's not working as I wanted to. Can any expert teach me the code? As I was creating a standard form (excel file), I don't want the users to overwrite the current file name.

View 9 Replies View Related

Macro To Save As Txt

Jul 10, 2008

I work with a read-only template, and desperately need a macro that would save it as a workbook, and every worksheet of it as a separate txt file, then close the whole thing.

I will be re-using that workbook it just saved again, and I want to have the same macro there as well (that it should save my workbook as workbook and every worksheet as a separate txt file).

View 9 Replies View Related

Before Save Macro

Mar 27, 2009

In My sheet I would like to check to make sure col 15 is true before going through the process of adding the contents of each row from col 6 - 10 to column 5. (Col 5 could already contain values)

This is my
Private Sub Workbook_ThisWorkbook(ByVal SaveAsUI As Boolean, cancel As Boolean)
BeginRow = 8
EndRow = 87
ChkCol = 15
BeginCol = 6
EndCol = 10

For RowCnt = BeginRow To EndRow
If Cells(RowCnt, ChkCol).Value = True Then
For RowCnt = BeginRow To EndRow
Cells(RowCnt, 5).Value = Cells(RowCnt, 5).Value + Cells(RowCnt, ColCnt).Value
Next ColCnt
End If
Next RowCnt
End Sub

View 9 Replies View Related

Macro Will Not Save

Apr 3, 2009

when I record a macro in excel and assign it to a command button, it does not save and have to keep recording it when I open up the workbook again. I notice when i close out of the script editor after saving, the debugger box does not pop up when on most occassions it does.

This does not happen all the time, just some of the time which makes absolutely no sense to me. I have double checked to make sure the module is saved under the current workbook, i have tried saving the script to my personal macro workbook (XLSTART), i have tried saving the file on a shared drive and my desktop, but nothing seems to work. The workbook is not protected and am at a complete loss.

View 9 Replies View Related

Save A Macro Under Another Name

Aug 8, 2009

so i can save the macro and try (usually unsuccessfully) to change it.
excel 2002

View 9 Replies View Related

Macro To Save Only Some Changes

Jul 14, 2006

I have a 4 sheet workbook. 3rd and 4th are hidden running formulas. These hidden sheets have macros that creates a new file from each (the macros deleted unwanted rows in the files, then save as a seperate file and format [.mht and .csv respectively]). Everything functions properly, except the problem is, I need to make sure the changes to sheet 1 are saved, but when I save the file, the changes to 3 and 4 are saved, and I lose the formulas.

View 4 Replies View Related

Run Macro After Save

Jan 17, 2007

I would like to run a macro AFTER the user has saved the workbook. I can only think of manipulating the before save event but dont know how to do that.

View 9 Replies View Related

Running A Macro On Save?

Apr 10, 2014

I'm trying to get a macro to run when the user presses the save button. I have the following code:

[Code] .......

This code is supposed to apply the TRIM function to every worksheet in the workbook when the user presses save, and the saves the results. I understand the Private Sub bit is the code to have the macro run during the save, but for some reason the macro itself isn't actually running. I'm not getting any error message, its just that the cells which should have the TRIM function applied to them aren't being corrected.

View 4 Replies View Related

Payroll Save As PDF Using Macro?

Jun 17, 2014

I have a problem in saving multiple pdfs from excel. I am posting a sheet here. First sheet has the employee details. Second sheet have the template for payslip. My aim is to save pdfs of templates of all the employee in the list using a macro.

currently i am doing it as

1. In sheet 2, I lookup each employee using the serial number of employees at the top left corner cell of the template.

2. Once the details are updated in sheet 2 i save it as pdf in my desktop.

The problem with recording macro and looping is that the pdfs are overwritting and the last pdf alone is saved. i could not find how to change the pdf name for every loop.

View 2 Replies View Related

Macro To Save Sheet As PDF?

Feb 27, 2014

I need a macro that will save the range of cells with values as a pdf and saved as the sheet name. I have a macro that does a print preview function based on the cells that contain values. It works great, but instead I just need this to be saved as a pdf.

This is what I have:

[Code] .....

View 2 Replies View Related

Save All Macro(s) In Personal.xls

Jan 2, 2009

I have quite a few macro's saved on my personal xls file. Anyway for me to save them with the current date to a specific folder?

e.g. MacroNameDate.bas

View 5 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved