+ Reply to Thread
Results 1 to 8 of 8

VBA: Create a new folder on any users desktop and save the file as value in cell (A51)

  1. #1
    Registered User
    Join Date
    03-06-2013
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    45

    VBA: Create a new folder on any users desktop and save the file as value in cell (A51)

    Sorry to hijack the thread but I have been looking every where for a solution and you guys seem to have the answers. VBA FTW, I am trying to use your code below. It works as written to create the folder on the desktop but, I need it to save the workbook with a file name listed in cell ("A51"). Any way you can help?




    HTML Code: 
    What I want is for my remote employees to click a command button which will check for the folder on the deskop. If it is not there create it and save the file.

    Thanks in advance,

  2. #2
    Valued Forum Contributor
    Join Date
    02-08-2012
    Location
    Newcastle, Australia
    MS-Off Ver
    Excel 2007 and Excel 2010
    Posts
    1,429

    Re: VBA: Create a new folder on any users desktop and save the file as value in cell (A51)

    Hi,

    The code is already very close, just needed a few extra lines beneath the FolderExists label.

    I hope this helps

  3. #3
    Registered User
    Join Date
    03-06-2013
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    45

    Re: VBA: Create a new folder on any users desktop and save the file as value in cell (A51)

    Works Great! Do you know how to surpress the runtime error if you are to press no or cancel when the "file already exists do you want to overwrite.
    Run Time Error.jpg

  4. #4
    Valued Forum Contributor
    Join Date
    02-08-2012
    Location
    Newcastle, Australia
    MS-Off Ver
    Excel 2007 and Excel 2010
    Posts
    1,429

    Re: VBA: Create a new folder on any users desktop and save the file as value in cell (A51)

    Sure, change the If...Then...Else loop below the FolderExists label to the following:
    Please Login or Register  to view this content.
    The Application.DisplayAlerts = False tells Excel to just overwrite the file without asking you if that's what you want to do or not.

    Hope this helps

  5. #5
    Registered User
    Join Date
    03-06-2013
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    45

    Re: VBA: Create a new folder on any users desktop and save the file as value in cell (A51)

    I would rather it not overwrite automatically, i want the overwrite warning just to close if user presses no or cancel and say msgBox "File Not Saved"

  6. #6
    Valued Forum Contributor
    Join Date
    02-08-2012
    Location
    Newcastle, Australia
    MS-Off Ver
    Excel 2007 and Excel 2010
    Posts
    1,429

    Re: VBA: Create a new folder on any users desktop and save the file as value in cell (A51)

    Ah OK sorry, try this file then

    I have created a custom overwrite prompt so as to avoid the error.

  7. #7
    Registered User
    Join Date
    03-06-2013
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    45

    Re: VBA: Create a new folder on any users desktop and save the file as value in cell (A51)

    That seems to be the ticket! You sir are a gentleman and a scholar. I have been messing with the code for 2 days.

  8. #8
    Valued Forum Contributor
    Join Date
    02-08-2012
    Location
    Newcastle, Australia
    MS-Off Ver
    Excel 2007 and Excel 2010
    Posts
    1,429

    Re: VBA: Create a new folder on any users desktop and save the file as value in cell (A51)

    Hahaha no problem, glad I could help

    Please don't forget to mark this thread as solved and please click on the * next to my post to say 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] save as CSV file on desktop but in a 'New folder'
    By mike02 in forum Excel General
    Replies: 6
    Last Post: 08-15-2012, 05:25 PM
  2. [SOLVED] Macro to save mail merged word docs to users desktop and with a desired file name
    By bonny24tycoon in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-22-2012, 12:27 PM
  3. [SOLVED] How would I save a text file to a folder on the users desktop without knowing the path?
    By 111StepsAhead in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 05-21-2012, 01:36 PM
  4. Macro to save duplicate file and create folder name based on cell value
    By munkee in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 04-19-2012, 12:09 PM
  5. Replies: 6
    Last Post: 08-11-2006, 03:41 PM

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