Consulting

Results 1 to 3 of 3

Thread: I want to create a Macro That will save

  1. #1
    VBAX Regular Erays's Avatar
    Joined
    Mar 2005
    Posts
    73
    Location

    I want to create a Macro That will save

    I want to create a macro that will save an activeworksheet to a specific folder on the desktop, you see I am user LC67b, and I want it to work with other users, they could be any user such as lc59b Example below
    C:\Documents and Settings\LC67b\Desktop\ExcelWorkbooks\

  2. #2
    VBAX Expert
    Joined
    Feb 2005
    Posts
    929
    Location
    Quote Originally Posted by Erays
    I want to create a macro that will save an activeworksheet to a specific folder on the desktop, you see I am user LC67b, and I want it to work with other users, they could be any user such as lc59b Example below
    C:\Documents and Settings\LC67b\Desktop\ExcelWorkbooks\
    I think you mean activeworkbook. You can save the activeworkbook anywhere you like using the Workbook().Close procedure. If LC67b is your logon name, you can fetch that by calling Application.UserName. So, we could construct a general proc that will save the active workbook to the correct location. It might be something like:

    Sub SaveSpecial()
    Dim NewFileName As String
    NewFileName = "C:\Documents and Settings\" + Application.UserName + _
            "\Desktop\ExcelWorkbooks\" + ActiveWorkbook.Name
    ActiveWorkbook.Close SaveChanges:=True, Filename:=NewFileName
    End Sub

  3. #3
    Site Admin
    Jedi Master
    VBAX Guru Jacob Hilderbrand's Avatar
    Joined
    Jun 2004
    Location
    Roseville, CA
    Posts
    3,712
    Location
    Additionally you should check out this Kb Entry for a method of getting the Desktop address.

Posting Permissions

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