I used invoke code for merging some cells together but instead of saving the excel file as it is, the program create another file of same name to another directory (default C:\Users\P\Documents\ , when the original file is on desktop)
How do i overwrite the file and save it like how excel application scope does it instead of creating a new excel workbook of same name?
Here’s the Code:
Dim excel As Microsoft.Office.Interop.Excel.Application
Dim wb As Microsoft.Office.Interop.Excel.Workbook
Dim ws As Microsoft.Office.Interop.Excel.Worksheet
excel = New Microsoft.Office.Interop.Excel.Applicationclass
wb = excel.Workbooks.Open(filee, [ReadOnly]:=False)
excel.Visible=True
excel.DisplayAlerts = False
ws=CType(wb.Sheets("Sheetssd1"),Microsoft.Office.Interop.Excel.Worksheet)
ws.Range("B1:D1").Merge
ws.Range("A1:A3").Merge
ws.Range("B2:C2").Merge
ws.Range("E1:E3").Merge
ws.Range("F1:G1").Merge
ws.Range("F2:G2").Merge
ws.Range("H1:H3").Merge
ws.Range("I1:I3").Merge
ws.Range("J1:J2").Merge
ws.Range("K1:K3").Merge
wb.Save()
wb.close()
Sorry for any mistakes, this is my first time using codes