AnsweredAssumed Answered

Save path to a dynamic desktop location

Question asked by Jeff Thurgood on Jul 3, 2018
Latest reply on Jul 3, 2018 by Jeff Thurgood

I have a macro that saves a step file to my desktop, but I want to share this macro on a network location and allow others to use it. But I need it to save to their desktop. Is there a way to query the current user and set the path to their desktop? Below is my current snippet of code. I need the filepath to be "C:\Users\CURRENT USER\Desktop.


  Filepath = "C:\Users\jefft\Desktop"

  Filepath = Filepath + "\"

  Filename = Mid(swDraw.GetPathName, InStrRev(swDraw.GetPathName, "\") + 1)

  Filename = Left(Filename, InStrRev(Filename, ".") - 1)

        swModel.Extension.SaveAs Filepath & Filename & ".step", swSaveAsCurrentVersion, swSaveAsOptions_Silent, Nothing, nErrors, nWarnings

        MsgBox "STEP File saved to Desktop!"



Thanks in advance!