Hi there,

I was trying to edit a excel document and save under different name and my coding for this is as follows.

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click


        'Open
        Dim MyExcel As New Excel.Application
        MyExcel.Workbooks.Open("C:\Test\WalkAir.xlsx")

        'Extract
        MyExcel.Sheets("sheet1").Activate()
        MyExcel.Range("A99").Activate()

        MyExcel.ActiveCell.Value = TextBox1.Text


        MyExcel.SaveAs("C:\Test\alkAir.xlsx")
        MyExcel.Workbooks.Close()
        MyExcel = Nothing

    End Sub

While debugging the code it resulting with me an error message as Public member 'SaveAs' on type 'ApplicationClass' not found.

I would be much obliged if you can help me in this issue.

Best Regards

Just use the SaveWorkspace method with the desired filename.

Just use the SaveWorkspace method with the desired filename.

It result with me the same error

Try

MyExcel.Workbooks(1).SaveAs(filename)

or

MyExcel.ActiveWorkBook.SaveAs(filename)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.