Save File As Cell Value (Date)
Jan 4, 2008
I'm working on creating a computerised invoicing system for where I work, and right now I'm creating a Day Book file.
I want the name of the file to simply be the date which it was created, in YYYYMMDD format. However, I keep getting the error message and am not sure what has gone wrong.
Please note that in the day book template, cell F1 contains the formula
=TEXT(E1,"yyyymmdd")
which may be useful to know in the later part of the code.
from the code below?
Private Sub DayBook_Click()
Select Case MsgBox("Proceed? (Ensure that a Day Book has not already been created)", vbYesNo Or vbQuestion Or vbDefaultButton1, "Day Book Creation")
Case vbYes
Dim strName As String
'copy today's date from invoice template
Range("H4").Select
Application.CutCopyMode = False
Selection.Copy
View 3 Replies
ADVERTISEMENT
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
Jan 26, 2007
Is it possible to save a file with a date taken from a cell? For example:
I have an Excel file opened, in the cell A1 there is a date: 12.04.2003 (or any other date format). I want an Excel to save this document, but after I check the date of creation (modification) of the file under Windows, I want to receive the result 12.04.2004 (or any other, that was in the cell "A1" before pressing SAVE button).
I imagine, that there would have to be some external script running, that would change the system date for a moment, just after detection of pressing SAVE command.
View 9 Replies
View Related
Jun 5, 2008
I have this script that runs. and checks to see if anything is in C1. If something is, it saves...if it doesn't, it fails and does not save.
Sub SaveAsCell()
Dim strName As String
On Error Goto InvalidName
strName = Sheet1. Range("C1")
ActiveWorkbook.SaveAs strName
Exit Sub
InvalidName: MsgBox "The text: " & strName & _
" is not a valid file name.", vbCritical, "TitleBar Name" ........
View 9 Replies
View Related
Jun 19, 2014
I'm trying to make a vba that would save the file with the end date that will reference to a certain cell that user selects it. Working Sheet is a name of a File, and Current Sheet is a name of the panel where user will select the date.
ActiveWorkbook.SaveAs Filename:= WorkingSheet("Control Sheet").Range("D3").Value & Format(Date, "yyyymm") & ".xlsm", FileFormat:=51
But here i seem to missing the location
And I tried this one:
ActiveWorkbook.SaveAs Filename:="X:Work2014WorkingSheet& Format(Date,"yyyymm"). & ".xlsm" _, FileFormat:=xlOpenXMLWorkbookMacroEnabled, CreateBackup:=False
but it keeps popping up as 'expected end of statement' for yyymm?
View 8 Replies
View Related
Mar 11, 2014
am using Excel 2010 and having issues trying to save a worksheet to a specified file location with the save date....
I have tried several posts form this forum and elsewhere and can't seem to get the macro to do what I want.....
I want to save a 'worksheet' from an open workbook that I use for updating information to the same file path as the workbook with the date the file saved...
View 6 Replies
View Related
Oct 10, 2011
VBA coding for automatically saving an excel file as another file using the current date as part of the file name together with "32ga" as a constant add-in. I also what this macro to run at a particular time of the day let say 00:20hrs. The excel file i want to save as is always open . It has data that changes every 24-hrs.
View 1 Replies
View Related
Jun 4, 2009
I'm working on the following
Workbooks.Open Filename:= _
"D:CommondataIBMmainBRANCHBURG-PRODUCTS-BOM-ALUMINUM-UPDATE-" & Ucase(Format(DateAdd("y", 0, Date)), "YYYY-MM-DD")&".XLS"
ChDir "D:CommondataIBMmain"
ActiveWorkbook.SaveAs Filename:= _
"D:CommondataIBMmainBRANCHBURG-PRODUCTS-BOM-ALUMINUM-UPDATE-NAFTA.XLS", _
FileFormat:=xlNormal, Password:="", WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=False
ActiveWindow.Close
Date: 2009-06-03
What I'm trying too do is open a file, make an exact copy and save it under a new file name.
My problem is in the date formula the day is not always the same. In the sample case it's 03 at other times the day will change.
is there a way too get this too work irregardles of what the day might be?
View 9 Replies
View Related
Aug 16, 2008
In the code that i have, vb is making me a excel file and saves it with the title i putted.
I want him to save my files like this: example dd:mm:yyyy
Here is the
Sub Export()
Workbooks.Add
ActiveWorkbook.SaveAs Filename:= _
"D:Sablon citiriCalea 13 Septembrie_Sablon citiri.xls", FileFormat:= _
xlExcel8, Password:="", WriteResPassword:="", ReadOnlyRecommended:=False _
, CreateBackup:=False
Call MsgBox("Va rog sa asteptati pana se creeaza registrul de lucru.
Some of the words are in romanian.
The bold text ,if is possible, it should be like this: D:Sablon citiriCalea 13 Septembrie_dd:mm:yyyy.xls (the date when i do the saving).
View 9 Replies
View Related
Apr 16, 2009
I'm trying to write a VBA code to save a file with the word "northeast" and then today's date. So today the file would be saved as "Northeast - April 16, 2009". I can't seem to figure it out. Anyone have any ideas?
View 9 Replies
View Related
Jan 8, 2013
How do I save a file with yesterdays date, within a macro. This is what i have now
Code:
ActiveWorkbook.SaveAs Filename:= _
"S:Marks dataRENAME ME.xlsm" _
, FileFormat:=xlOpenXMLWorkbookMacroEnabled, CreateBackup:=False
I want to replace Rename me with yesterdays date. When I run the macro every morning.
View 3 Replies
View Related
Apr 24, 2008
Is it possible that each time I save a file it saves the filename along with date and time as the version of the file in a specific path
View 9 Replies
View Related
Nov 7, 2006
The following macro is returning a 1004 runtime error.
FName1 is a book title PHOTOSHOP MADE EASY which is trimmed to remove blank spaces at the end.
FName2 is the date =Today() formatted dd/mm/yy.
When the 1004 error appears the filepath shown looks like this ...
View 5 Replies
View Related
Aug 9, 2012
I want to create a macro that when executed changes the name of "File1" to "File1 - Edited 8-9-2012". With the date being today's date (variable). This file is going to be emailed to someone who will then execute this macro.
Is there a way to prompt the Save As window with the updated file name so the user can save the file where ever he/she wants?
View 9 Replies
View Related
Mar 13, 2007
I've got a simple save macro below and was looking for a way that when this macro saves the file can it add the system date and time to the name.
'ChDir "C:
ashfinch"
' ActiveWorkbook.SaveAs Filename:="C:
ashfinchNFC-ORDER.XLS", FileFormat:= _
' xlNormal, Password:="", WriteResPassword:="", ReadOnlyRecommended:=False _
' , CreateBackup:=False
View 3 Replies
View Related
Jun 21, 2008
We have an excel file which is made every thursday for comparison purposes etc. I've made an macro (excel 2003) which - on start - asks via an inputbox for the extension in date format for saving purposes. Later on, the macro will search for the same file but from last week to open it and copy/paste a 'comments' column into this new one. All went well, everybody happy. However it may be well possible that file is made and saved but with an extra extension: example:
dir to save = C:file
file when starts runs inputbox "Please enter a date (e.g. 2008-06-20)"
The macro records this string as mydate:
Sub Start()
Dim AnyString
Dim MyStr
Dim DirString
Dim mynum 'As String
Dim resp As Long
Dim get_mynum
Dim mydate
'Define extension for the file name to be saved and the correct path (dir) where this file will be stored.
get_mynum:
mynum = Application.InputBox("Enter the filename's extension to save in yyyy-mm-dd (e.g. 2008-06-30)", vbOKCancel)
If mynum = False Then
msgbox ("You do not want to continue? Ok, programm stopped")
Exit Sub
ElseIf mynum = "" Then..............
View 9 Replies
View Related
Aug 7, 2008
I have a report which I have written a macro to reformat, I then want to copy the sheet (Remake) containing the report into a new workbook as the only sheet in the new workbook. I want the sheet name to be changed from "Remake" to "Duty to Consider" and I want the new workbook to save itself automatically as "Duty to Consider - Month/Year" - in this case it would be "Duty to Consider - August 2008".
I think that a Pop Up box which lets me input the Month and Year of the report I am working on would be useful in naming the new workbook, if this box popped up when I click the button which runs my Macro that'd be great. Here is the code I am using to reformat my report. This works fine I just need the changes I mentioned. Application. ScreenUpdating = False 'this will turn on screen updating, making the macro run faster
'This will select the DTC Tab and remove rows 1-4
Sheets("DTC").Select
Rows("1:4").Select
Range("A4").Activate
Selection.Delete Shift:=xlUp
'This will add a filter to the data to remove duplicate rows
Range("A1").Select
Range("A1:J1307").AdvancedFilter Action:=xlFilterInPlace, Unique:=True
'This will copy the data on the DTC tab and copy it into the Remake Tab
Cells.Select.....................
View 2 Replies
View Related
Jul 10, 2014
I have a Workbook that already has a macro in it that will generate multiple sheets based on certain criteria.
For each of these newly generated sheets (numbered 1-6 in the attached example), I need to be able save each of them to a PDF file based on a unique name contained in a certain cell (in this case, each named is referenced in cell Q1 of each sheet). As such, I should end up with 6 pdfs based on the attached sample files.
The PDFs would ideally need to be landscaped and should be just 1 page per sheet.
In my attached sample workbook, you'll notice that I have a "PracticePrint" macro that doesn't quite get the job done. One other criteria involves not printing any sheet with the characters "1010" in it (my PracticePrint macro is setup to do that, but it fails to do much else).
View 1 Replies
View Related
Jul 5, 2009
I have an excel file which I use when I book keep journals in work. Each time I come across a new piece of bookkeeping I add to the file, name the sheet and index it. (I've attached a loose example for illustration) so the bookkeeping template.xls gets bigger every day.
Currently, when I book keep on a particular day, I open the template.xls workbook;
draft my journals;
and then manually copy the worksheets I have completed during the day from the template.xls workbook and paste the sheets into a new book and save the days bookkeeping as the current date.
With the file I have attached can someone show me how to write a macro and apply it to each of the buttons on the various work sheet tabs (each button will run the same macro).
Upon clicking a button, I would like the macro to;
Copy the active sheet into a new book and save the file as the current date.
Each subsequent click of a button the macro will check if the .xls file exists for the current date, if it does, then it will just copy the active worksheet to the file that has already been created.
In the new file which is saved as the current date, I need to remove the macro button and the hyperlink that reads back to index.
I have had some helpful macro's provided from another forum, however, the other forum does not appear to enable users to upload files, so I can't quite convey what it is I am trying to achieve.
View 14 Replies
View Related
Feb 17, 2009
I'd like a macro to have the workbook save as
Numbers as of "today's Date"
and then close that workbook.
I already tried the following...
View 5 Replies
View Related
Oct 16, 2008
I am trying to create a macro which will save the file and take the file name from cell values eg if cell A1 = "488" and Cell B1= "Buyers" when saved the file name would be 488_Buyers.
Can anyone point me in the right direction?
View 7 Replies
View Related
Oct 31, 2008
I have a excel workbook witha table and a chart.
I want to make him save with the name that it will be writen in the cell A2.
View 9 Replies
View Related
Mar 21, 2013
I have got a master workbook and I have written macro to copy and paste data on another workbook. write a macro to save the new workbook to a file path with a file name where both file name and path are stored in master workbook sheet...
View 5 Replies
View Related
Oct 6, 2009
I would like to be able to open a template and save the contents of cell B19 as the file name.
Can I do this so i don't have to press a button to run the macro. I have only done one macro previously and that was with the help of people on this forum so don't get to technical.
If possible I would like to be able to save it on the server X:
eportsoffender PDF's
View 10 Replies
View Related
Dec 3, 2007
Could any Excel wiz out there tell me whether the following is possible, and if so what would be the VB code to do it?
I would like a macro that will save the contents of cell A2 in a text file, with file name from cell A1, then move the cursor down to the next row, and repeat the process until reaching the last row of data.
The end result would be a stack of text files, each containing the data from a single cell in the spreadsheet.
e.g.
001.txt (containing the contents of cell A2)
002.txt (containing the contents of cell B2)
003.txt (containing the contents of cell C2)
...etc.
This is for a multi lingual dictionary so the text files would have to be unicode as well.
View 12 Replies
View Related
Mar 10, 2009
I have a file where cell A1 is the name of the file along with B1 and C1 which provide the versions and variations:-
A1 - Sales Analysis
B1 - Version 2
C1 - Variation C
Is it possible to have a macro driven off a button button which will save the file as (current path to current folder) and then Sales Analysis Version 2 Variation C
View 8 Replies
View Related
Oct 28, 2012
By using a macro is it possible to save just a cell value as a txt file?
This is part of a Forex system I am building using excel.
There will be 28 pairs and a total of 168 buttons. Each button will be assigned a cell which will hold the information for that trade.
I am looking for a macro that will save just the cell value as trade.txt
View 4 Replies
View Related
Nov 26, 2007
i currently have a macro on my sheet which when the file opens will chaneg a cell value by +1 and save the new worksheet as that value.
What i would like is for the new worksheet to automatically save in a new folder relevant to another cell value. So i can save the sheets in job no order.
Can't seem to get it to work....
Here is a copy of my macro so far:
Sub SequentialNumber()
Const InitialValue = 1
Const increment = 1
Const prefix = ""
Const suffix = ""
Dim existSN As Boolean
Dim existMF As Boolean
Dim master As Boolean
Dim cdp As DocumentProperty
Dim SeqNumber As Long
Dim FSName As Variant
existSN = False
existMF = False
master = False.........
View 9 Replies
View Related
May 1, 2009
When you click File>Save As, you get a save as window that shows the current file name to "Save As"
I would like to create a macro that shows the values in a couple of cells (lets use Range("A1") & Range("B2")) instead of the current file name.
View 4 Replies
View Related
Mar 6, 2014
I want to save my file as a pdf based on cell reference A4.
This is what i have
[Code] ....
View 2 Replies
View Related