The following is how I'm opening an Excel file in Form_Load when VB first starts:The VB program changes the cell values in test.xls. If the user wants to save the changes, I have a menu option:Code:Set xlApp = New Excel.Application Set xlBook = xlApp.Workbooks.Open(App.Path & "\test.xls") Set xlSheetData = xlBook.Worksheets("input")My primary question is - the next time the user runs the VB application, how can I modify the Form_Load code so that the saved "xlFile" is loaded instead of the default "test.xls"? Also, is it possible to show the Excel file name in the caption property of a Form?Code:Private Sub mnuSave_Click() Dim xlFile As String On Error Resume Next comDialog.Filter = "Excel File (*.xls) | *.xls" comDialog.FileName = "*.xls" xlFile = comDialog.FileName xlBook.SaveAs xlFile End Sub
Thanks




Reply With Quote