Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
cstephens58F4Q
in reply to: WCrihfield

@WCrihfield again on this section of code. Any reason you could see why I would be getting the attached error in this line of code: oDoc.SaveFileAs(oPath & loc)

 

error:

System.MissingMemberException: 'Public member 'SaveFileAs' on type '_DocumentClass' not found.'

 

Issue area:

    Public Sub CreateStandardPart(x_length As Double, y_length As Double, z_length As Double, loc As String, oPath As String)

        MsgBox("here with x length = " & x_length)


        'Create a new part with your desired part template
        'Dim oApp As Class = g_inventorApplication

        Dim oProjectMgr As DesignProjectManager = g_inventorApplication.DesignProjectManager

        Dim oProject As DesignProject
        oProject = oProjectMgr.ActiveDesignProject

        Dim oTemplatesPath As String
        oTemplatesPath = oProject.TemplatesPath

        Dim oDoc As PartDocument = g_inventorApplication.Documents.Add(DocumentTypeEnum.kPartDocumentObject, oTemplatesPath & "/English/OC Standard.ipt", True)

        oDoc.Activate()

        oDoc.SaveFileAs(oPath & loc)



    End Sub

 

Here is how I am calling out oPath:

SaveFileDialog1.Filter = "Assembly|*.iam"
        SaveFileDialog1.InitialDirectory = "C:\Temp"
        SaveFileDialog1.Title = "Save Melter Model"
        SaveFileDialog1.ShowDialog()

        If SaveFileDialog1.FileName IsNot "" Then

            SaveFileDialog1.OpenFile()

            oFile = SaveFileDialog1.FileName




        End If

        '''''
        ''Sets directory for future use
        '''''

        Dim oPath_ As String = oFile

        Dim oPat As Integer = InStrRev(oPath_, "\")

        Dim oPath As String = Mid(oPath_, 1, oPat)