VBA To Create A New Folder From A Textbox Value

Feb 15, 2005

I don't know if anyone has tried this but it possible using vba to create a new folder in a directory from the text of a textbox?

I have made a userform that I use to collect a persons first name & surname.

I then created a folder in a directory manually (e.g Z:spnzphotos)

I then scan their photo and place it into the folder.

Is it at all possible to have a piece of code that once I press a command button is creates folder ready for me to add the photo to?

View 6 Replies


ADVERTISEMENT

Add-In To Create A New Workbook In Same Folder

Sep 9, 2008

Is there a way of creating a new excel workbook using a macro that is stored as an Add-In.

The new workbook is to be created in the same folder. If I use the following command in macro then it saves the file in the Add-In folder.

View 14 Replies View Related

Create Folder Failing

Jun 16, 2009

i run this macro but it fails

Can anbody tell me why please?

And how can i correct it? .....

View 6 Replies View Related

Create A New Folder From A Cell Value

Aug 24, 2009

I am wondering if it is possible to get excel to Create a new folder from a cell value? I am entring data into cells Eg A1-F1, and then the next line of data is in A2-F2 and so on. What I'd like is when I enter data (the date) in the F column then it will create a folder with the value of H2 (=A2&B2&D2&E2)

View 14 Replies View Related

Search And Create A Folder?

Sep 16, 2013

create macro for the below scenario I need to search whether "Sep-13" folder is available in my desktop. If folder is there then i need to open the folder else i need to creat a folder in the name "Sep-13" and open the folder.

View 4 Replies View Related

Create Hyperlink To Folder

Sep 4, 2009

I'm trying to create a link to a folder and to insert it in a cell. The folder name is: "C:DISCO CTEMPLATES #1". I tried to copy that text and paste it into the cell. Excel recognizes that as a hyperlink but when I click the cell a message appears: "Cannot open the selected file" Could the problem be because of the "#" symbol?

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

Macro To Create Folder In Computer

Mar 6, 2014

Can a macro create a folder in my computer and use the value in cell A1 as the folder name? This is where I want the folder to be created C:UsersUserDesktop.

View 8 Replies View Related

Check If Folder Exists, If Not Create It

Jan 28, 2009

I need to check if a folder exists and if not then create it. not sure how to go about this

View 2 Replies View Related

Create Both Folder And Subfolders Using Coloum A And B

Sep 23, 2009

I am totally new to both EXcel 2007 and Programming however i would really like to create a main folder using coloum A and then a subfolder within the main folder just created using coloum B.

I have looked on line and found some code but when i put/assign the code to a button it never appears to work.

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

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

Create A Windows Folder On A Server

Feb 3, 2009

I would like a windows folder to be created on a server from cell Cbut to be filtered by the Data in B.

dwights folder on teh server to create '124 elm street' from the in C1
james folder to the server to create the folder '15 killfops' street'from C5

\server empdwight
\server empjames .....

View 9 Replies View Related

Code To Check For And Create New Folder

Sep 13, 2006

I have a macro that creates a spreadsheet on a weekly basis and have been using it for quite sometime. Due to the large number of spreadsheets I would like to incorporate some code that would create a folder every month. I would assume that the code would need to include a check routine to see if a folder for that month exsists.

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

Create Folder And Subfolder With Name Based On Cells

Mar 12, 2013

I need to activsheet create in .pdf witch i did with this

VB:
Sub Save_As() ' macro za snimanje racuna u PDF pomocu Microsoftovog ugradjenog alata za Office 2010
Dim txtName As String
txtName = "D:
eports" & Range("G14") & "_" & Range("L3") & "_" & Range("E18") 'ime nove datoteke i folder u koji se snima
ActiveSheet.ExportAsFixedFormat _
Type:=xlTypePDF, _
filename:=txtName, _
OpenAfterPublish:=False
End Sub

and for that pdf file i need to create folder based on cell e.g. q1 and sub folder l3 and all that in case that they dont exist and if they are just put file in it. For example i fill out sheet (one of many in one day) and i click buton and sheet go to pdf in subfolder L3 in folder Q3.

View 1 Replies View Related

Code To Create Folder And Inside Subfolder

Mar 7, 2014

The code below is sending back an error. It's supposed to create a folder and a subfolder within it and if the folder already exists then a msg box should pop up saying that folder already exists.

[Code] ....

View 14 Replies View Related

Create Automatic Link To Files In Same Folder

Apr 28, 2009

I have two files,

1. Form Templete & 2. Student Data Index. (Both files will be placed in same folder)

About Form Templete : This is a simple form, containing some fields. Fields which i require are Form No., Student's name & Standard.

About Student Data Index : This file is to maintain records.
Each time when I fill form for a new student i will copy paste the form templete file & rename it by form no. (Entered in the Form Templete file, Form No. field)

My question is : Is it possible that whenever i create a new file in the same folder with student's name the required fields in the Student data Index get filled automatically, apart from that the new file created get hyperlinked & when i click on form no. the form for that student gets open?

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

Create Folder & Export Sheet, Not Working

May 28, 2009

I was working on some code that would create a new folder in My Documents and within that folder export the current worksheet and save it there with a particular name. After doing so I need it to return to the original worksheet and clear contents. I would also need to export to the new sheet only contents of the cells without any macros or buttons.

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

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

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

Create A Folder Structure Before Dumping A CSV Export

Jan 19, 2010

I am trying to create a folder structure before dumping a CSV export frm the Excel. I am trying to use MkDir but it gives me a run time error 76.

I am testig the code in my PC. Pleaselet em know if I have to change any configuration in excel file.
Also, is there a way to call the windows system command and create the folder structure?

View 9 Replies View Related

Create Folder.... Make Directory MkDir

Nov 11, 2003

how can I creat a directory and then save the same file into that directory. At the moment Im using -

ThisFile = Range("T3").Value
ActiveWorkbook.SaveAs FileName:=ThisFile

...which works great, but before I do this, I want to create a folder with the name the name/value in T4, then ofcourse save the file into that folder ....

View 9 Replies View Related

Create Directory Or Folder Using Date In Cell

Aug 25, 2008

How can you add the date from a sheet say A1 which is a long date and make a directory which the date incorporated into the new directory name?

View 2 Replies View Related

BeforeSave, Create Folder & Sub-foldername If Has Not Been Created

Oct 13, 2004

Example below is in my macro and when my peer is running this worksheet which has Workbook_Open() enabled in "ThisWorkbook", the outcome is that he can not successfully save this workbook because he doesn't have the folder and sub directory in his C: drive.

How do I code it such that in the event the user does not have the specified folder and sub-foldername, it will automatically create one for him and save it as "C:Spare PartsCritical ListStocking Status.xls".

Application.DisplayAlerts = False
ActiveWorkbook.SaveAs Filename:= _
"C:Spare PartsCritical ListStocking Status.xls"

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

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

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







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