DWG and PDF macro on desktop

Hello.
I would like a macro that saves a plan in dwg and pdf directly on my desktop. I find macros that melt it directly into the plan folder, but I can't define the path to the desktop.
Thank you for your help

1 Like

Good evening
Post the macro you found and we'll explain where to edit.

2 Likes

Hello, thank you for the feedback.
This macro saves the files to the clip's original folder
Thanks for helping me

Dim swApp As Object
Dim Part As Object
Dim boolstatus As Boolean
Dim longstatus As Long, longwarnings As Long
Dim FeatureData As Object
Dim Feature As Object
Dim Component As Object
Sub main()
Set swApp = Application.SldWorks
Set Part = swApp.ActiveDoc
Path = Part.GetPathName ' file path
Part.SaveAs2 Left(Path, (Len(Path) - 6)) & "PDF", 0, True, False '
Part.SaveAs2 Left(Path, (Len(Path) - 6)) & DWG, 0, True, False
Set Part = Nothing

End Sub

Hello, we need to change as follows:

Dim swApp As Object
Dim Part As Object
Dim boolstatus As Boolean
Dim longstatus As Long, longwarnings As Long
Dim FeatureData As Object
Dim Feature As Object
Dim Component As Object
Sub main()
Set swApp = Application.SldWorks
Set Part = swApp.ActiveDoc
Path = Part.GetPathName 'chemin du fichier
Path =  Mid(Path, InStrRev(Path, "\") + 1) 'Purge le chemin d'accès
Path = Environ("userprofile") & "\Desktop\" & Path
Part.SaveAs2 Left(Path, (Len(Path) - 6)) & « PDF », 0, True, False 'Sauvegarde au format PDF
Part.SaveAs2 Left(Path, (Len(Path) - 6)) & « DWG », 0, True, False 'Sauvegarde au format DWG
Set Part = Nothing`
1 Like

Great it works, thank you so much for your help :smile:

1 Like