+ Reply to Thread
Results 1 to 9 of 9

Make Directory

  1. #1
    Registered User
    Join Date
    04-21-2017
    Location
    Tennessee
    MS-Off Ver
    2013
    Posts
    24

    Make Directory

    I understand the concept of MkDir command where I use it to make a new folder in some directory such as MkDir "C:\Test\Test" and also in how to make a folder based on a textbox input such as MkDir "C:\test\" & txtRMA.text. No issues there I know that a folder in the test directory will be named whatever the value of txtRMA.text is. My question is I need to create two folders inside of that one that is INBOUND and the other is OUTBOUND. Basically looking to do this: "C:\test\((VAL)txtRMA.text)\INBOUND" and "C:\test\((VAL)txtRMA.text)\OUTBOUND" all in one step if possible. Any assistance would be greatly appreciated. Sorry no excel file or screenshots this is early in the program and do not have anything in the file yet.

  2. #2
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,006

    Re: Make Directory

    This will get you started :

    Please Login or Register  to view this content.
    Attached Files Attached Files

  3. #3
    Registered User
    Join Date
    04-21-2017
    Location
    Tennessee
    MS-Off Ver
    2013
    Posts
    24

    Re: Make Directory

    Thank you, Logit,

    After reading through your suggestion I found that I was leaving out a string and used the following to do what I was needing to do.

    Dim newfolder As String
    Dim newfolder2 As String
    Dim path As String
    Dim path2 As String

    If Len(Dir("c:\test\" & txtRMA.Text, vbDirectory)) = 0 Then
    path = txtRMA.Text
    MkDir "C:\test\" & path


    path2 = "C:\test\" & path

    MkDir path2 & "\Inbound"
    MkDir path2 & "\Outbound"

    End If

    This did exactly what I needed it to do and I again appreciate the help. As you can see I did not use any part of the spreadsheet. I do plan on using that later as storage for time received repair and time depart or repair facility and other stuff like storage location and whatever else is needed. However, I know I need to have a MSGBOX that will popup after the text box is populated that asks "Inbound or Outbound" to select the desired folder but would you have any suggestions as to how I could use a webcam, or something similar that would take 3-4 pictures with the push of a button and have them saved in the selected folder from the MSGBOX?

  4. #4
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,006

    Re: Make Directory

    Glad you found an answer !

  5. #5
    Registered User
    Join Date
    04-21-2017
    Location
    Tennessee
    MS-Off Ver
    2013
    Posts
    24

    Re: Make Directory

    New question for the make directory strings from before. My work receives repairs daily and ships repairs out daily. We have ran into some shipping issues and would like to cover ourselves with pictures both of the inbound and outbound product. Is there a way in which I can automatically have these pictures saved in their respective folders? Or at least, once the camera is connected to the computer it will open the respective folder as the 'suggested" location?

  6. #6
    Registered User
    Join Date
    04-21-2017
    Location
    Tennessee
    MS-Off Ver
    2013
    Posts
    24

    Re: Make Directory

    Was wondering if I could bother you for one more quick solution? I have this same program that you helped me with a few months ago and have ran into a problem. If the existing folders already exist I get a debug error. Is there a way to go from the following to compare and see if the directory already exists and skip all the MKDIR commands and have it just open the existing folders? Thanks for your help.

    Dim newfolder As String
    Dim newfolder2 As String
    Dim path As String
    Dim path2 As String

    If Len(Dir("c:\test\" & txtRMA.Text, vbDirectory)) = 0 Then
    path = txtRMA.Text
    MkDir "C:\test\" & path


    path2 = "C:\test\" & path

    MkDir path2 & "\Inbound"
    MkDir path2 & "\Outbound"

    End If

  7. #7
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,288

    Re: Make Directory

    Administrative Note:

    @renrut_5 - TWO POSTS

    We would very much like to help you with your query, however you need to include code tags around your code.

    Please take a moment to add the tags. Posting code between [code]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/code] tags makes your code much easier to read and copy for testing, and it also maintains VBA formatting.

    Please see Forum Rule #2 about code tags and adjust accordingly. Click on Edit to open your post, then highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here

    (Note: this change is not optional. No help to be offered until this moderation request has been fulfilled.)
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  8. #8
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,006

    Re: Make Directory

    renrut_5

    Answers are pending. You must comply with the Moderator first.

  9. #9
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,288

    Re: Make Directory

    Administrative Note:

    @ren_rut5

    Sorry, but your post does not comply with Rule #6 of our Forum RULES:

    Please do not ignore requests by Administrators, Moderators and senior forum members regarding forum rules.

    If you are unclear about the request or instruction, then send a private message to them asking for clarification.

    All Participants:

    Please do not post a reply in a thread where a Moderator or Administrator has requested an action that has not yet been complied with (e.g. title change, code tags requested, etc.). Thanks.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] macro to copy excel files only from main directory and sub directory to a specific folder
    By JEAN1972 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-05-2019, 09:49 AM
  2. [SOLVED] Proper way to Make Directory with subs
    By zplugger in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-24-2015, 01:55 PM
  3. Replies: 0
    Last Post: 09-05-2013, 10:00 AM
  4. Replies: 3
    Last Post: 09-08-2012, 07:52 PM
  5. How do i make a telephone directory for the office
    By Anil in forum Excel - New Users/Basics
    Replies: 1
    Last Post: 05-20-2006, 05:15 PM
  6. [SOLVED] How do I make a school directory?
    By Kathy in forum Excel - New Users/Basics
    Replies: 2
    Last Post: 05-09-2006, 11:55 AM
  7. make a list of files in a directory
    By GFN in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-29-2005, 02:49 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1