+ Reply to Thread
Results 1 to 6 of 6

Saving Notepad (.txt) to Desktop

  1. #1
    Registered User
    Join Date
    06-20-2014
    Location
    Fayetteville, NC
    MS-Off Ver
    2016
    Posts
    11

    Saving Notepad (.txt) to Desktop

    Good evening,

    I'm currently having an issue of saving a .txt file to the current user's desktop. The code below is supposed to print values from Excel to a Notepad file and then save to the desktop of the current user; however, I've run this with two different users and the files was placed into two different folders neither of which were the desktop. One user found the created Notepad file in a previously created folder on the desktop; the second user found the file in their documents folder.

    Please Login or Register  to view this content.

    Thanks,

    Nick
    Last edited by Nick_Long; 03-14-2018 at 11:22 PM. Reason: Rule 3 Compliance

  2. #2
    Forum Expert kersplash's Avatar
    Join Date
    11-22-2016
    Location
    Perth
    MS-Off Ver
    Home 2016 (Windows 10)/Work 2013 Pro Plus (Windows 10)
    Posts
    2,012

    Re: Saving Notepad (.txt) to Desktop

    Insert a messagebox before the Open and display what the variable sFilename is at this point.

  3. #3
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,518

    Re: Saving Notepad (.txt) to Desktop

    1)
    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code.

    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, it also maintains VBA formatting.

    Click on Edit to open your thread, 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

    2) change
    Please Login or Register  to view this content.
    to
    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    06-20-2014
    Location
    Fayetteville, NC
    MS-Off Ver
    2016
    Posts
    11

    Re: Saving Notepad (.txt) to Desktop

    Thanks for troubleshooting tip. I set message boxes after each change to 'sFileName' and noticed not everything was appending as the path and file name changed... failed to pay attention to the details and I had misspelled 'defaultpath' in the final step.

  5. #5
    Registered User
    Join Date
    06-20-2014
    Location
    Fayetteville, NC
    MS-Off Ver
    2016
    Posts
    11

    Re: Saving Notepad (.txt) to Desktop

    Quote Originally Posted by kersplash View Post
    Insert a messagebox before the Open and display what the variable sFilename is at this point.
    Thanks for troubleshooting tip. I set message boxes after each change to 'sFileName' and noticed not everything was appending as the path and file name changed... failed to pay attention to the details and I had misspelled 'defaultpath' in the final step.

  6. #6
    Registered User
    Join Date
    06-20-2014
    Location
    Fayetteville, NC
    MS-Off Ver
    2016
    Posts
    11

    Re: Saving Notepad (.txt) to Desktop

    Quote Originally Posted by jindon View Post

    2) change
    Please Login or Register  to view this content.
    to
    Please Login or Register  to view this content.
    Thanks for the help, I updated the script using your recommendations and everything works as intended.

+ 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] Closing notepad without Saving
    By prabhuduraraj09 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-09-2017, 02:41 AM
  2. Open with Notepad Issue after saving CSV
    By aaron.mendes in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 08-06-2014, 09:45 AM
  3. [SOLVED] Saving Textbox value to a notepad (VBA)
    By nathan0519 in forum Excel General
    Replies: 7
    Last Post: 07-09-2014, 08:28 PM
  4. Saving Notepad from VBA
    By ricardodickstein in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 11-06-2009, 11:18 AM
  5. Saving a desktop shortcut
    By wilro85 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-21-2008, 02:58 PM
  6. sPath saving to desktop on different pc's
    By jsmity in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-18-2007, 10:10 AM
  7. VB editor not saving desktop
    By [email protected] in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-25-2005, 02:05 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