Macro To Save A File To Specific Folder?
Dec 7, 2012
I have a folder called "Report" at C: and inside this folder there are 12 folder named from 1 to 12 ("1","2",...,"12")
I need a macro to save my workbook as a file in C:Report(one of these folders depending on the month of a certain cell)
i.e. if the date in this cell is 8/12/2012 .. then save my file in C:Report12*.xlsm
This is the code i use
Code:
Private Sub CommandButton1_Click()
Dim fname As String
fname = Format$(Range("S8"), "dd-mm-yyyy")
On Error Resume Next
ActiveWorkbook.SaveAs Filename:="C:Reort" & fname & ".xlsm"
End Sub
So what i need now is what to insert after C:Report
View 9 Replies
ADVERTISEMENT
Jul 6, 2012
I am trying to open a website, then for excel to download the csv file, then for it to save it in a specific folder under a specific name and file format (excel).
I am successful at opening the website with the following code, but how to do the rest.
Sub Searchez()
Dim IE As Object
Set IE = CreateObject("InternetExplorer.Application")
IE.Navigate "http://quote.morningstar.ca/Quicktakes/stock/keyratios.aspx?t=clwr®ion=USA&culture=en-CA&ops=clear" 'load web page google.com
IE.Visible = True
While IE.Busy
DoEvents
Wend
'IE.Navigate2 "javascript:SRT_keystuts.exportcsv()"
'this is the name of the download link as from when i hover my pointer over download link.
End Sub
View 1 Replies
View Related
Dec 4, 2007
I recorded a macro to save a workbook to a specific folder using the current file name. However, I've tried to remove the absolute reference to a specific filename but it is not working for me. Am I close?
ActiveWorkbook.SaveAs Filename:= _
"H:Files and DocumentsPROJECTSSR 2 SS Phase Two Component ReliabilityWinTrac Files xt_conversionsexcel_version" & SheetName _
, FileFormat:=xlOpenXMLWorkbook, CreateBackup:=False
View 2 Replies
View Related
Apr 29, 2014
Looking for VBA code to automatically save an excel file as an .xlsx format, and saving to a specific folder: C:UserswolfmDesktopLoad Lists
I have been using the attached code, but it's not working. It saves to the desktop, not the folder. Also, when it creates the file name based on sFile = ActiveSheet.Range("C4").Value & ".xlsx", it adds wierd things to the file name. I want the file name to be simply the value in C4.
View 2 Replies
View Related
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
May 27, 2009
I want to create a macro that will create a new folder called "Fungicide Quotes" under my documents and will save the workbook using the cell reference d4:f4 for the file name, which are merged cells. I have tried the following but can't get it to work. Any help would be appreciated, Thanks
Sub Save_wrkbk()
Dim strFilename, strDirname, strPathname, strDefpath As String
On Error Resume Next
strDirname = "Fungicide Quotes"
strFilename = Range("d4:f4").Value
strDefpath = "C:My Documents"
If IsEmpty(Filename) Then Exit Sub
MkDir strDefpath & strDirname
strPathname = strDefpath & strDirname & "" & strFilename.......................
View 9 Replies
View Related
Mar 27, 2014
how to save multiple file with other names in the same folder
View 1 Replies
View Related
Aug 6, 2008
I have a report send to me daily. And I want to have a macro to save this report in the daily folder, such as “c:
eports8052008”, so tomorrow 's folder would be “c:eports8062008”.
All the daily folders already exist. Just need to change the file path. I tried some codes including sPath and format(now(), “mmddyyyy”), get error message.
View 9 Replies
View Related
Nov 25, 2009
I currently use the following code to create a duplicate file based on two cells within a directory and folder i specify. These cells consist of the team and week commencing date (mondays date of week which is cell 'Main Menu'!K8)
View 7 Replies
View Related
May 14, 2014
I have alot of project folders on my harddrive.
All in format: I:/12345-costumer-projectname/
The five digits are unique for each project.
I make calculations for these projects using an excel file. In this excel I also type the projectnumber (cell J2)
Now i would like to make a button. When pressed, it checks the projectnumber cell J2, looksup the corresponding folder and saves the excelfile in PDF format in this folder.
I have found macro to find files in folders, but none which do the above.
View 4 Replies
View Related
Mar 25, 2013
I have a current macro that saves each sheet as their own file. The first 10-15 sheets are not really necessary, so I typically delete them once the macro has run. I am looking to add two things to my current code:
1. Add a tab called Start. Make the macro look for 'Start' tab and then just save each sheet to the right of that as its own file.
2. Save each sheet in the macro as just a copy/paste value. They current have a lot of links and it makes each file close to 3MB. That makes it incredibily difficult to paste all in one email.
Here is the current code:
Sub CreateWorkbooks()
'Creates an individual workbook for each worksheet in the active workbook.
Dim wbDest As Workbook
Dim wbSource As Workbook
Dim sht As Object
Dim strSavePath As String
On Error GoTo ErrorHandler
[Code] ..........
View 1 Replies
View Related
Jun 16, 2009
I have found out how I save my document as workbook name and date, but now I want to add the saved file to a specific folder instead of just in my dokument folder. This is what I have done so far (SAVING FILE IN A SPECIFIC FOLDER):
View 5 Replies
View Related
Jan 10, 2007
I'm trying to use the code below to paste special my first sheet to remove the formulas, then delete all other worksheets then save as a reference number (which is linked to the worksheet im saving) but I also need it to save in a specific folder.
Sub SaveAsCell()
ActiveWorkbook.Save
Cells.Select
Selection.Copy
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
Sheets("Cat Nos").Visible = True
Sheets("Supplier Info").Visible = True
Sheets("Codes").Visible = True
Sheets("Buyers").Visible = True.................................
View 3 Replies
View Related
Apr 13, 2009
looking for some code to save to a destination
destination address is
C:Documents and SettingsstDesktopOJF
now the problem is OJF has folders named 1 to 500
so if cell d5 = 487 it will need to look in the above desination and then open the folder and save it there.
View 10 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
Jan 6, 2009
I have a bill of materials for each job I do, I have multiple cut sheets in one spot on the network that must be individually copied and pasted into the project file for each job. I’m hoping to automate the process. Post extraction dump from AutoCAD, my text file goes into a excel file that the information is used by multiple tabs including a bill of materials.
From the bill of materials, I want to say “if C3>0 get file 10P0044HP2.DOC” . . . I want it to get the file and save to the individual project file. .. Possible I’m not so sure. But I’m not sure of where to start.
View 9 Replies
View Related
Apr 23, 2009
I'm running a macro that intially opens an input box where you specify the filepath and name of a .ped file to import into the macro. The default path of H:BOM2.ped may not always be the path I use. It may be just H:.ped or H:Bom1.ped.
HTML INITIAL CHECK
Response = MsgBox(".............do you want to import BOM data?", vbYesNo)
Do Until Response = vbNo
'SELECT RAW FILE
Dim Message, Title, Default, MyValue
Message = "Please Enter PathFile Name for Source File"
Title = "Create CHINA INSPECTION REPORT(s)" ' Set Title.
Default = "H:BOM2.ped" ' Set Default.......
View 9 Replies
View Related
Mar 2, 2007
I want to add the columns in the attached sheet...any 4,say A,C,D and F.....as follows,if the number in the cell is less than .8,I want use 1 in the sum,otherwise zero. I would like to do this in 1 column if possible. in the attached sheet,I have filled in manually the answer in column L....Thus row 1 contained no numbers less than .8 in the selected columns,where as row 8 had all four numbers less than .8.
View 6 Replies
View Related
Jul 17, 2014
How do I write a vba code to print active sheet to pdf, auto save in specific folder then mail using outlook
im using 'Nitro PDF Creator'
also id like it to automatically save the pdf as the same file name as the active worksheet and also auto enter the following when opening the email server:-
Address: Cell D18
Subject: Cell D21
Email body:
find attached quotation
Optional installation available on request
View 2 Replies
View Related
Apr 3, 2014
In sub which will convert file to PDF and save it to assigned folder and then attach it to email in outlook. All works fine.
However is is possible to modify the code to save fole to respective month folder ( as per current date and year)?
e.g. I have created folder Named 'Trial' in C drive . This has sub folders 2014, 2015, 2016, 2017, 2018 Each year folder will have sub-sub folders month wise like This has sub folders as Jan , Feb , Mar , Apr .... till Dec Now e.g. if date when the pdf was created is 23/4/14 then it is saved in C:Trials2014Apr automatically. Currently every year I keep creating new folders etc... bit primitive though.
View 2 Replies
View Related
May 22, 2009
I have a macro which saves file to a specific folder. Problem is I can save the file only in my local drive C: but not on a server for some reason.
Here is the
At home in my home computer this code worked when C: was selected.
ChDir ("c:")
Title = Application.GetSaveAsFilename(Name, "Excel files (*.xls), *.xls")
ActiveWorkbook.SaveAs Name
Save the file in specific place
But when I substituted C: path with my server path it doesnt work! Have a look. Its the exact same code except my path is different.
ChDir ("\Lnf001Lnf1vol1SharedOP_ENGWork Order")
Title = Application.GetSaveAsFilename(Name, "Excel files (*.xls), *.xls")
ActiveWorkbook.SaveAs Name
View 9 Replies
View Related
Aug 26, 2008
I have an Excel workbook with 2 worksheets in it. One of the worksheets imports a txt file and then the other worksheet displays data that formulas I have written have collected.
I usually import the txt file by running through the many steps with the "import data" option. This is good but I want it to be faster.
I used the macro recorder and ended up with the following code
With ActiveSheet.QueryTables.Add(Connection:= _
"TEXT;\DesktopImport FolderTest.txt" _
, Destination:= Range("A1"))
.Name = "Test"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
View 5 Replies
View Related
Mar 13, 2007
I am trying to write a macro to find a file in a specific folder. The file name changes weekly. (Ex. C:My Folder31207.xls). I need to find the most recently modified version of the file and open it.
View 4 Replies
View Related
Jun 26, 2014
There is a problem in joining one cell to the other file
The below is screen shot when l click the on every cell the image must be open
How can do it?
Capture.PNG
View 1 Replies
View Related
Jul 21, 2014
I was looking over web for a vba code that will open yesterdays last modified (saved) file in a specific folder.
In these folder is for eac day one file, so it has to open yesterday, not today - yesterday last saved (modified).
View 1 Replies
View Related
Nov 21, 2012
I have to open each pdf file in a specific folder, select and copy all contents and paste it in column 'A' of a new workbook.
I have tried following code but not worked...
Code:
Sub ConvertPDF(control As IRibbonControl)
Dim AdobeApp As String
Dim AdobeFile As String
Dim StartAdobe
Dim fso As New FileSystemObject
[Code]...
I have Acrobat Reader installed. Any method without using 'SendKeys'?
View 1 Replies
View Related
Aug 29, 2012
I have a requirement to search workbooks in a particular folder with specific string in file name. For example, let us assume I need to find a file which contains the name 'RR' in it. The position of 'RR' will vary with files i.e. 'RR' might be present either in the beginning, middle or at the end of file name. All I wanted is to search for file with 'RR' and do some activity and close the file and then goto next file. Similarly, the next search has to be performed with the files containing the name 'BB' in it.
View 1 Replies
View Related
Sep 26, 2007
I have a variable list. Each column will be 250 digits and numbers of rows will be variable. I want a macro to import a text file from a specific folder into a sheet without split it to columns. So we will work only in column A
Then macro will find B1002 wording in A1. if it is exist, it will copy the next 36 digits after B1002 wording if not then it will search A2 row. The next step will be to search and find another wording "B1001" if it finds it will replace copied 36 digits text. If it can not find B1001 wording it will go to upper row and search B1001 wording here and paste the text. This will go on till row shows #END. This means it reached the end of the list. And then macro will save this file as text file to another folder.
So macro will go to beginning to open other file in the folder and this will go on till last file in the folder.
This is the logic of the macro. Here is the sample of what I want.
Original Data: ....
View 9 Replies
View Related
Oct 8, 2008
I have a macro that currently saves and prints the sheet I'm working on. At the moment, it saves everything in the same place and always calls the file the same name.
In the worksheet, a lookup does actually specify what folder it should be saved in and what name it should be given. How can I write the code so that it pulls up the name and the folder directly from the sheet it's saving?
View 3 Replies
View Related
Sep 17, 2009
Our small company only has 5 computers in it with mine acting as the "server". I want to put a macro on our customer order forms that all computers can access on the server that will save the file as 3 or 4 cell names serparated by commas and save it in a specific location on the server.
I got the macro to work perfectly on my computer but when I try to type in the appropriate path to the server the file gets saved in their My Documents folder 99% of the time. I did get it to work twice but it seembed to be completely random as it didn't work any of the times before or after.
Here's what I have so far: ...
View 9 Replies
View Related