1
Basically she has to open the drawing 2d of a selected mount file generate the PDF and close, got something, but only works with the path file, do not know which command to use for it to work with any file you choose.
' ******************************************************************************
' C:\Users\Home\AppData\Local\Temp\swx9936\Macro1.swb - macro recorded on 06/29/16 by Home
' ******************************************************************************
Dim swApp As Object
Dim Part As Object
Dim boolstatus As Boolean
Dim longstatus As Long, longwarnings As Long
Sub main()
Set swApp = _
Application.SldWorks
Set Part = swApp.ActiveDoc
boolstatus = Part.Extension.SelectByID2("PLACA BASE SUPERIOR-1@MOLDE HÉLICE", "COMPONENT", 0, 0, 0, False, 0, Nothing, 0)
Set Part = swApp.OpenDoc6("D:\PROJETOS SOLIDWORKS\PAULINHO FERRAMENTARIA\MOLDE HELICE-2\PLACA BASE SUPERIOR.SLDDRW", 3, 0, "", longstatus, longwarnings)
Set Part = swApp.ActiveDoc
swApp.ActivateDoc2 "PLACA BASE SUPERIOR - Sheet1", False, longstatus
''''''''''''''''''''''''''
Dim FilePath As String
Dim PathSize As Long
Dim PathNoExtention As String
Dim NewFilePath As String
FilePath = Part.GetPathName
PathSize = Strings.Len(FilePath)
PathNoExtention = Strings.Left(FilePath, PathSize - 6)
NewFilePath = PathNoExtention & "pdf"
Part.SaveAs2 NewFilePath, 0, True, False
Set Part = Nothing
swApp.CloseDoc "PLACA BASE SUPERIOR - Sheet1"
End Sub
I don’t know what Soliworks is, so I decided to comment rather than simply edit directly. Does it even make sense to have the tags [tag:vba] and [tag:visual-basic-6] in the question? VBA and VB are not the same thing.
– Luiz Vieira