Results 1 to 2 of 2

Thread: Macro (Save As)

  1. #1
    Join Date
    Jun 2012
    Posts
    85

    Unanswered: Macro (Save As)

    Hey, Im currently running a macro which seperates the worksheets in my work book into seperate files 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
    Mike
    ________

  2. #2
    Join Date
    Jan 2002
    Location
    Bay Area
    Posts
    511
    I found this code on a dotcom website called excelforum. The subject was "Save to Desktop". The function identifies the desktop path.

    Code:
    Function GetDesktopPath() As String
    
      Dim DskTop As String
      Dim WSH As Object
      
        Set WSH = CreateObject("WScript.Shell")
        DskTop = WSH.SpecialFolders("desktop")
        
        GetDesktopPath = DskTop
      
       'Free the object reference and memory allocated
        Set WSH = Nothing
        
    End Function

Posting Permissions

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