hello guys, i'm trying to make some changes on 2 files and then later save the changes but each time i debbug the program the files that i used turn into read only can you please tell me what im doing wrong in the save part
i guess that i'm doing something wrong in the saveas() function . that you so much guys on correcting me if i wrongCode:ws1 = xlApp.Workbooks.Open(TextBox1.Text).Worksheets(ComboBox1.SelectedItem) ws2 = xlApp.Workbooks.Open(TextBox2.Text).Worksheets(ComboBox2.SelectedItem) work1 = xlApp.Workbooks.Open(TextBox1.Text) work2 = xlApp.Workbooks.Open(TextBox2.Text) " i make some changes to the files in textbox1 and textbox2 here the code is so big " ws2.SaveAs(TextBox2.Text) work2.Close() ws1.SaveAs(TextBox1.Text) work1.Close() xlApp.Quit() releaseObject(xlApp) releaseObject(work1) releaseObject(work2) Private Sub releaseObject(ByVal obj As Object) Try System.Runtime.InteropServices.Marshal.ReleaseComObject(obj) obj = Nothing Catch ex As Exception obj = Nothing Finally GC.Collect() End Try End Sub




Reply With Quote
