I’m opening a workbook from Access, populating and formatting some cells and saving the workbook. I need to put some code in workbook sub so when user opens the spreadsheet code will be triggered. Below is the code that I use to create the workbook.
Please let me know if that is possible to modify the code in the Workbook_Open(). Thanks for your help.VB Code:
Dim xlExcel As Excel.Application Dim xlWorkbook As Excel.Workbook Dim xlWorksheet As Excel.Worksheet Set xlExcel = CreateObject("Excel.Application") Set xlWorkbook = xlExcel.Workbooks.Open(strFilePath) 'do some formating 'need to change or put some code in Workbook_Open() xlWorkbook.Save xlWorkbook.Close xlExcel.Application.Quit Set xlWorkbook = Nothing Set xlExcel = Nothing




Reply With Quote