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


ADVERTISEMENT

Save File Under Current Name In A Selected Location

May 4, 2006

I get an xl file sent to me every day which I upload into a database. I then save the file keeping its name and save it into a selected folder. Is it possible to add a macro at the beginning of my current macro that saves the file using its name to a selected folder?

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

Get Current Folder Location In VBA

Apr 20, 2012

How to query the current folder location in VBA?

The macro will need to import text from a file (file.out) located in iteration folders (iteration_001, etc) but I need to start by seaching the location that the excel file has been saved in.

View 5 Replies View Related

Open Multiple Files, Check Current Month & Save To New Location

Sep 15, 2007

I have 40 files in one folder which I named it as "CA" + month's name that I am working on. I need to do analyse these files monthly and save it under new folder. how do I automatically save them in new folder and name them for that particular month. Also, each file has worksheet which has one cell as "Aug-07" and the cell next to it has number of that month that is "08". How do I automatically change this also based on the name of the file, because file name month and month in the cell are the same.

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

Create Folder Location Lookup From Database Values?

Feb 7, 2014

I have a template for information that needs uploaded into a database via CSV. This database is then access via a HTML front end. As part of this there is a 'folder structure' with in the front end. This is displayed in a database table (See attached excel file for example data structure)

Currently I have this feeding into a drop down list which is somewhat cumbersome so want to make it more efficient and easier to use. I had toyed with the idea of adding more columns into the excel template and split the string up to populate however this isnt exactly professional looking.

My current thinking is, is there a way of putting this data into a listbox which is easy to navigate? Ideally in a folder tree navigation structure, I know this is possible for a windows folder structure

Folder Structure.xlsx

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

Macro To Save Files In New Folder With Current Month And Date

May 6, 2014

I have this existing macro which saves each tab into a separate excel file. However, I'd like for it to also save them together in a new folder using the current month and date (named: QA Files May_05.06.14). The month and date would change according to current month/date. How would I incorporate that into this code? I am not good with macros.

Sub tabname()
Dim ws As Worksheet
For Each ws In Worksheets
ws.Activate
ws.Name = Range("D1").Value
Next

[Code]...

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

Copy Current (Selected) Sheet To New Workbook And Save As Tab Name

Feb 28, 2014

I want to take the current sheet and copy to a new workbook (keeping the tab name) and then save as the tab name (xlsl) and close.

I've found ones that do a Saveas box or ends up saving as "Sheet1," "Sheet2" etc but can't seem to find one that keeps tab name and saves.

Here is the one I was using, but it saves all tabs not just selected:

Code:
Sub CopySheet()
Dim fname As Variant, ws As Worksheet, wb As Workbook
Dim nCol As Integer, iCol As Integer

[Code].....

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

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

Save To A Folder That Is Current Month And Have It Save To Next Month?

Jul 14, 2014

Here is a macro I am using to save a workbook using 'Save As' .

I have it open a template workbook we use, and then perform a save as, pathed to a specific folder on the desktop. We do this every night just before midnight.

What I haven't been able to figure out is how to have it save to the next month folder (The folders with the name of all the months are already created) on the last day of each current month.

For example. In my code, the final folder in the path is the current month July. On July 31 when I run the macro, I would like it to save it in the folder called August.

Is there a way to code this so it will recognize what the current month is and then at the end of each current month save it in the next month?

[Code] .....

View 12 Replies View Related

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

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

VBA - Create Folder With Date In Name, Populate With Sheets

May 27, 2009

I have a workbook that will have many modules (5) that will perform all sort of checks etc. The output for each module is a worksheet that i need to export to a new workbook named with the name of the original sheet and current date appended e.g. "Dbase 27 06 2008.xls".

Every time any of the 5 modules is run a check is performed whether a folder with a specific name and date exists e.g. "Audit Tool 27 06 2008" and if it does not exist yet to create it. The new workbook should be saved to this folder with above mentioned name e.g. "Dbase 27 06 2008". I found some info on this topic but I just cannot assemble all pieces of code together (I am new to this).

View 2 Replies View Related

Export Selected Sheets To New And Save But Ignore Formulas

Mar 28, 2007

I borrowed the macro below from this forum. My formulas in the sheets I'm copying refer to other sheets that I'm not saving. can someone tell me how to change it so that it copies values only to the new workbook as I'm only saving it for records purposes and some cells are saved with #REF errors.

I'm guessing there's a spot where I should type .Value ? Copy.Value doesn't work.

View 9 Replies View Related

Create Workbooks From Sheets & Append Current Date To Saved Names

Apr 22, 2008

I have a workbook with multiple worksheets. First 4 tabs are the standard tabs and rest of the tabs are created based ona macro with the unique names. Now i want to create the separate workbook for each tab by its name and , date and time stamp in a C directory.

View 5 Replies View Related

VBA To Create Individual Sheets From Workbook And Save

Feb 12, 2010

I have a workbook with roughly 28 tabs(sheets) and i need to be able to run a macro that will create a new sheet for each tab and name it based on the tab name.

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

For All Workbooks In Folder - Copy Range To Different Workbook - Save To New Folder?

Apr 21, 2014

I have up to 50 workbooks in one folder with data in a specific range. I also have one workbook which includes additional data, including conditional formatting and dropdowns. I need to copy the desired range from the first workbook in the source folder to the second workbook, then save the latter to my destination folder, using the same name as the first. I need to repeat this process for all workbooks in the source folder.

View 2 Replies View Related

Image Folder - Save 500 Images In Another Folder?

Jul 18, 2014

I have a list of items in an excel sheet... 500 of them... and there are images for them in an other folder... The problem is those images are in 1000's and I only need those 500 images.. Images are saved as "SKU.jpg eg NS2354.jpg and we have an SKU column in excel as well .. SKU and their images have same name...

Is there any solution to pick up only those 500 images from those thousands of images?

Is it possible to save those 500 images in an other folder?

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

Change The Folder Location

Dec 14, 2006

which part of this macro I need to edit to make it open a folder I want?


Sub OpenFolderRequest()
YesNo = MsgBox("Would you like to open the folder to see" _
& vbCr & "which files are currently there?", vbYesNo + vbQuestion, "Open Folder?")
Select Case YesNo
Case vbYes
myval = Shell("c:winntexplorer.exe c:winnt", 1)
Case vbNo
End Select
End Sub

I have tried changing the (c:winntexplorer.exe c:winnt) to the location name of the folder I want to open (S:Stock ControlSTOCK CONTROLOrder Confirmation)but it doesn’t seem to work.

View 9 Replies View Related

Generate A Folder Within A Specific Location

Nov 12, 2008

I am trying to generate a folder within a specific location (For now lets call it C:Jobs) that will be named as per the adjacent cell (Column H on attached)

Obviously if the folder already exists I want the code to stop.

But this code will have to generate a different folder for each row within the spreadsheet.

View 8 Replies View Related







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