Imports SolidWorks Imports SolidWorks.Interop.sldworks Imports SolidWorks.Interop.swdocumentmgr Public Class Form1 Dim swapp As SldWorks Dim fullname As String Dim filenamewithext As String Dim filelocation As String Dim Filename As String Dim Extension As String Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load End Sub Private Sub B_iniciar_Click(sender As Object, e As EventArgs) Handles B_iniciar.Click Try If swapp Is Nothing Then swapp = CreateObject("sldworks.application.29") Else swapp = GetObject("sldworks.application.29") End If Catch ex As Exception End Try swapp.Visible = True End Sub Private Sub B_obtener_info_Click(sender As Object, e As EventArgs) Handles B_obtener_info.Click Dim swmodel As ModelDoc2 swmodel = swapp.ActiveDoc fullname = swmodel.GetPathName If fullname <> "" Then filelocation = System.IO.Path.GetDirectoryName(fullname) Debug.Print("Carpeta Documento: " & filelocation) filenamewithext = System.IO.Path.GetFileName(fullname) Debug.Print("filenamewithext: " & filenamewithext) Filename = System.IO.Path.GetFileNameWithoutExtension(fullname) Debug.Print("Filename: " & Filename) Extension = System.IO.Path.GetExtension(fullname) Debug.Print("Extension: " & Extension) End If Dim tipo_doc As Integer Select Case LCase(Extension) Case ".sldprt" tipo_doc = 1 Case ".sldasm" tipo_doc = 2 Case ".slddrw" tipo_doc = 3 End Select MsgBox("este documento es de tipo: " & tipo_doc) End Sub End Class