Macro To Create New Folder And Save File

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


ADVERTISEMENT

Macro To Save Duplicate File And Create Folder Name Based On Cell Value

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

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

Save Macro - Create Folder If It Does Not Already Exist?

Sep 11, 2012

I have the following code which saves a certain sheet to a new workbook and then emails it to a range of cells. The directory the file is saved in is from a cell, and changes depending on certain cells in the workbook. I would like to make it so if the folder it is saving to does not exist, it will create it. If this isn't possible with this set up, I would just like it to display an error message if the folder is not present.

VB:
Sub Save_Report()
Dim wbName As String
Sheets("TELELINK & ITINERARY FORM").Copy

[Code].....

View 1 Replies View Related

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 View Related

Macro Save Multiple File With Other Names In Same Folder?

Mar 27, 2014

how to save multiple file with other names in the same folder

View 1 Replies View Related

Macro To Save As File To Current Daily Folder, Path Changes

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

Lookup Folder From Cell Text Then Save Excel File In This Folder

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

Create & Save Workbook To Same Path As Macro File

Aug 21, 2008

I have code to create a new workbook, and when I try to rename it I get "Compile error: Can't assign to read-only property."

Dim objXlApp As Object
Dim wkb As Workbook
Dim wks As Worksheet
Set objXlApp = CreateObject("Excel.Application")
' Create a workbook
Set wkb = objXlApp.Workbooks.Add
' Delete all worksheets bar the first one.
For Each wks In wkb.Worksheets
If Not wks.Index = 1 Then
wks.Delete

End If
Next wks
'Create some worksheets and names
With wkb
.Worksheets(1).Name = "myWorksheet1"
.Worksheets.Add.Name = "myWorksheet2"
.Worksheets.Add.Name = "myWorksheet3"
.Worksheets.Add.Name = "myWorksheet4"
End With...................................

View 5 Replies View Related

Open Website - Download CSV File / Save As In Specific Folder Under Different Name And File Type

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

Create And Name Folder And New Sheet Then Save

Jul 6, 2013

I'm having a little trouble making this code work correctly. This macro, Once finished, is connected to a (Save) command button. Here is what is suppose to happen, First thing to remember is another sheet (Sheet1) has been populated with various information which is used as a receipt. The information came from sheet2. I need to copy sheet1 just as it is, format included, create a new empty sheet, paste the information into the new sheet, name the new sheet with the values from cells in sheet2, E3, D3, and the date formatted as the month and year only. Then I need to create a folder in the my documents folder named from the values from sheet2, E3, D3, and todays date with the current time. If the folder already exists, then I just need it to change to that folder, and save the newly created worksheet (as named above) into that folder. After the save is executed, I need to delete that new sheet from the current workbook. Then I need to return to sheet2 to the last active cell and run the last few lines of code which collects the value of the cell 1 to the right of the active cell and transfers it to the cell 1 to the left of the active cell.

VB:
Public Sub Button11_Click()
Dim wShell, fso, strFldr, xdir As String
Dim newbal As String

[Code].....

View 9 Replies View Related

Create And Save Workbook In Folder

Apr 27, 2013

I want to write a piece of code where each day i run this code

I want add a workbook

Copy range ("A1:C5") to this new workbook

Save new workbook in a particular folder with the name customer data and todays date and save as CSV file

I run this this code every day so it should only add todays date at the end for filename

If for some reason I run this code again in the same day..

I want to have a msgbox stTing you have already ran this code today and exit sub

View 4 Replies View Related

Save Date As Text And Create Folder

Jun 14, 2009

In Cell N1 i have 02/02/09 but i have formatted it to look like Feb Invoices 2009. In the strpath below it saves the file to a folder In desktop/"Cell N1" But it tries to save it as c:Documents and SettingsDaveDesktop229 I would like it to save as c:Documents and SettingsDaveDesktopFeb Invoices 2009. Also if the folder does not exist the macro fails. How can change this macro to

1. Change the folder from 020209 to Feb Invoices 2009
2. If folder does not exist then create it.

View 2 Replies View Related

Macro To Locate Folder In A Folder And Save

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

VBA Create New Folder In Current Location And Save Selected Sheets As PDF

Feb 2, 2014

I have the below code that saves selected sheets of my workbook as pdfs in the current file location. What I would like this code to be able to do is to create a new folder (named with todays date), and then save each of the pdfs into this folder.

Code:
Sub SaveWorksheetsAsPDFs()
Dim sFile As String
Dim sPath As String
Dim fPath As String
Dim wks As Worksheet

[Code] ........

View 3 Replies View Related

Unprotect ALL Sheets, Create Folder And Save Copy On Desktop

Oct 23, 2007

I have a workbook which consists of 28 worksheets, all of which are protected, and are running on a code which automatically keeps all sheets at "unlocked cells" in the selection field. The sheet is also password protected for write-access…

I would like a Macro, or some sort of code, that when activated… it unprotects ALL sheets (which use same password), creates a folder on the users desktop, and saves a copy of the document in there… entitled "copy of {filename}" It must also remove the "write access" password…

View 9 Replies View Related

Save As File Name With A Cell Value As The Folder

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

Save A Copy Of A File To A Given Folder

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

Save File To Current Folder

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

Auto Create Folder And Save A1h20 Data As Reports Sheet

Dec 19, 2008

i want to create folder depending on cell value a1 select data from a1 to h20 save this as "b1 value.xls" my saving directory is c:

eports"a1value" ....

View 9 Replies View Related

Get File From Cell Values And Save In Another Folder

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

Save Workbook With Current File Name To Specific Folder

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

Create Folder And File From Cell Value

Mar 26, 2014

I have code that references a cell with a file path in it. If the filepath is not present I would like the folder and file to be created.

Sub Create_Path()
Dim strfolder As String
Dim filename As String
strfolder = Range("n17")
filename = Range("n16")
If Len(Dir(strfolder, vbDirectory)) = 0 Then
MkDir strfolder
End Sub

I have used this code but am getting an error at the "Mkdir strfolder" section. What do I need to change to create the file if no folder is found.

Cell N17 has the filepath

Cell N16 has what I would like to name the file as

View 4 Replies View Related

Save File In Respective Month Folder As Per Current Year Vba Modification

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

Create Pivot Table For Each File In Folder?

Apr 5, 2012

I have the following code that will open each file in a folder and run code on it. I'm trying to write code that will create a pivot table on each of the opned files...but cannot get past opening the file...

So I had built the vba code into a specific workbook so I could just drop that workbook into any folder I wanted to run code on files to and depending on the name of the file it would run different type of code. The problem has something to do with using "activesheet" for the pivot table wizard. It just doesn't like it and gives me a application 1004 error.

any way I can modify the activesheet so it will make a pivot of the newly opened file? I think what it is trying to do is make a pivot of the blank workbook that the code resides in

Sub filelooper()
MyDir = ActiveWorkbook.Path ' current path
Dim MyFile As String

[Code].....

View 1 Replies View Related

File Copy And Create Folder Based On Date

Nov 22, 2011

I want this filecopy to:
1. create a new folder in a subfolder called "/certificates".
2. name that folder the current date. ie. "/certificates/23.11.11".
3. copy the file into that folder.
4. If it's a duplicate then rename the file " - 2" or what ever the next number is.

Code:
Private Sub CommandButton2_Click()
Application.ScreenUpdating = False
Application.DisplayAlerts = False

[Code].....

View 3 Replies View Related

Create PDF File From Word Doc Inside A Folder With ID And Ref Number From Cells In Excel

Jul 31, 2014

I have an excel database where I register cases. I have in it a button that creates a folder with and ID nr that is in column A (I create new ID nr in the next row, when I press the button it will create a folder with that ID nr and inserts a blank word document in it). We have a template that we copy to the folder (depending what type of case). The idea would be that once the template is filled in and ready to print, It would take the values from the ID nr and a reference number a few cells to the right. Is it possible to tell excel to open the word document in the folder and create a PDF version with the ID nr and reference number. (there are only 2 templates, so the macro would have to look for one of the two in the folder)

The name of the templates are: "Standard" and "Other".

I guess the best way to start maybe this would be that I select the cell with the ID nr and then press a macro button to have this done.

One thing that needs to be done, is to put a copy in the same folder and another in a second folder called "Binder" in my documents folder.

View 1 Replies View Related

Create Hyperlink From Numbers In Column To Matching File Names In A Folder

May 21, 2013

I need a macro to create a hyperlink i.e....... I have an excel sheet with numbers in column A.....I have files in a folder that matches the numbers in column A....

How would I create a macro to create a hyperlink from the numbers in column A to the "matching" file names in a folder?

View 3 Replies View Related

Excel 2010 :: How To Activate File And Create A Folder In Named CustomUI

Jul 28, 2013

I have a Excel 2010 file that I want to activate the file and create a folder in it named customUI.

the steps to achieve this?

View 7 Replies View Related

Macro To Save As To Specific Folder

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







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