+ Reply to Thread
Results 1 to 5 of 5

Save AS Macro

  1. #1
    Registered User
    Join Date
    07-05-2012
    Location
    Ontario, Canade
    MS-Off Ver
    Excel 2010
    Posts
    88

    Save AS Macro

    Hey, Im currently running a macro which seperates the worksheets in my work book into seperate workbooks on my pc and then saves them individually on the desktop. It all works great until i sent it to another pc. The problem is that i have it saving through one specific pc. Ive tried playing with the code etc but to no avail. Here is where i believe the problem to be.

    ActiveWorkbook.SaveAs Filename:= _
    "C:\Users\WORKPC\Desktop\Address Information.xlsx", FileFormat:= _
    xlOpenXMLWorkbook, CreateBackup:=False

    Is there away to manipulate the code to save on someones desktop automatically?

    Thanks

  2. #2
    Forum Guru Ace_XL's Avatar
    Join Date
    06-04-2012
    Location
    UAE
    MS-Off Ver
    2016
    Posts
    6,074

    Re: Save AS Macro

    The problem seems to be the "users\WORKPC\" domain. Check for filepath to the desktop and modify accordingly.
    Life's a spreadsheet, Excel!
    Say thanks, Click *

  3. #3
    Forum Expert GeneralDisarray's Avatar
    Join Date
    09-15-2011
    Location
    Pittsburgh, PA, USA
    MS-Off Ver
    Windows Excel 2007/2010/2013
    Posts
    1,416

    Re: Save AS Macro

    well, you could have them run this on the desktop (actually save it to there and run it from the desktop).

    THen in the code, you can capture the string needed using the following line

    Activeworkbook.saveas filename:= ThisWorkbook.Path & Application.PathSeparator & "Address_Information.xlsx" FileFormat:=xlOpenXMLWorkbook, CreateBackup:=False
    Remember, saying thanks only takes a second or two. Click the star icon(*) below the post you liked, to give some Rep if you think an answer deserves it.

    Please,mark your thread [SOLVED] if you received your answer.

  4. #4
    Forum Expert GeneralDisarray's Avatar
    Join Date
    09-15-2011
    Location
    Pittsburgh, PA, USA
    MS-Off Ver
    Windows Excel 2007/2010/2013
    Posts
    1,416

    Re: Save AS Macro

    Or more generally, you might have them save the book to any place they like, and then stick the new sheets in a folder named "sheets" which is sitting in the same directory:

    1) they save the file
    2) make a folder in the same place named Sheets

    Use this line:

    Please Login or Register  to view this content.
    Main idea: you can get the path telling you where a file is sitting using .path

  5. #5
    Registered User
    Join Date
    07-05-2012
    Location
    Ontario, Canade
    MS-Off Ver
    Excel 2010
    Posts
    88

    Re: Save AS Macro

    thanks guys much appreciated, Thanks for helping!

    Have a nice day,

    Mike

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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