+ Reply to Thread
Results 1 to 4 of 4

Using Variables in SaveCopyAs?

  1. #1
    Forum Contributor NewYears1978's Avatar
    Join Date
    03-15-2010
    Location
    Forney, TX
    MS-Off Ver
    Excel 2016
    Posts
    962

    Using Variables in SaveCopyAs?

    Hi all

    This is my current code I use to backup my sheet while I am working
    Please Login or Register  to view this content.
    I need to change my name to the variable like %username% in windows so that it would work for any users computer. Also curious if it is possible to make it create the "My Sheet Backup" folder if it does not exist already, instead of throwing an error.

    I tried "Application.UserName" but that gave me "James Pyle" instead of "jpyle"

    Thanks in advance
    Last edited by NewYears1978; 07-25-2017 at 02:23 PM.

  2. #2
    Forum Guru sktneer's Avatar
    Join Date
    04-30-2011
    Location
    Kanpur, India
    MS-Off Ver
    Office 365
    Posts
    9,655

    Re: Using Variables in SaveCopyAs?

    Try Envrion function like below...

    Please Login or Register  to view this content.
    So the Environ("UserProfile") part replaces the C:\Users\jpyle part.
    Regards
    sktneer


    Treat people the way you want to be treated. Talk to people the way you want to be talked to.
    Respect is earned NOT given.

  3. #3
    Forum Contributor NewYears1978's Avatar
    Join Date
    03-15-2010
    Location
    Forney, TX
    MS-Off Ver
    Excel 2016
    Posts
    962

    Re: Using Variables in SaveCopyAs?

    That worked At least - as far as I can tell - lol.

  4. #4
    Forum Guru sktneer's Avatar
    Join Date
    04-30-2011
    Location
    Kanpur, India
    MS-Off Ver
    Office 365
    Posts
    9,655

    Re: Using Variables in SaveCopyAs?

    Glad it worked.
    Thanks for the feedback.

+ 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] SaveCopyAs macro
    By silentcarl in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-01-2015, 09:02 AM
  2. SaveCopyAs Method
    By TrafficGuy in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-10-2008, 03:44 PM
  3. SaveCopyAs from xls to xml
    By excel1 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-18-2008, 11:32 AM
  4. SaveCopyAs
    By tmkkoservo in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-21-2007, 07:21 PM
  5. SaveCopyAs
    By Mark in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-17-2006, 12:30 PM
  6. Question on SaveCopyAs
    By taylorm in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 03-22-2006, 07:50 PM
  7. [SOLVED] SaveCopyAs
    By broogle in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-10-2005, 11:06 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