954,514 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

VB.NET SaveAs coding result with debug error

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 asPublic member 'SaveAs' on type 'ApplicationClass' not found.

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

Best Regards

m4_prashanth
Newbie Poster
2 posts since Feb 2012
Reputation Points: 10
Solved Threads: 0
 

Just use the SaveWorkspace method with the desired filename.

Reverend Jim
Posting Shark
Moderator
1,167 posts since Aug 2010
Reputation Points: 253
Solved Threads: 159
 
Just use the SaveWorkspace method with the desired filename.

It result with me the same error

m4_prashanth
Newbie Poster
2 posts since Feb 2012
Reputation Points: 10
Solved Threads: 0
 

Try

MyExcel.Workbooks(1).SaveAs(filename)

or

MyExcel.ActiveWorkBook.SaveAs(filename)

Reverend Jim
Posting Shark
Moderator
1,167 posts since Aug 2010
Reputation Points: 253
Solved Threads: 159
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: