Dear Gurus,
I have a project which I'm working on that needs to have an excel file opened during its execution.
Now, I have the following code which is running on each single form:
Is it possible to place the code just once, so that the first part will be executed at the loading of the project (and then I just have to activate the worksheets that I need from time to time), and the last two rows just when I close the project?Code:Dim xlApp As Excel.Application Dim xlWorkBook As Excel.Workbook Dim xlWorkSheet As Excel.Worksheet xlApp = New Excel.Application xlApp.Visible = False xlWorkBook = xlApp.Workbooks.Open("C:\Users\Public\Documents\Modello.xlsm", [ReadOnly]:=False, Editable:=True) .... xlWorkBook.Close(SaveChanges:=True) xlApp.Quit()
Thanks in advance for your help,
A.




Reply With Quote
