agentkramr
Board Regular
- Joined
- Dec 27, 2021
- Messages
- 98
- Platform
- Windows
i have been using a vbs to run on closed workbooks but i want to convert it if the workbooks are open and not close them to keep them open, since i am having a refreshing issue when they are closed. This code works great if they are closed but when i get to the open portions i get lost very quickly
Code:
Dim objExcel
Dim objWorkBook
Set objExcel = CreateObject("EXCEL.APPLICATION")
Set objWorkBook = objExcel.Workbooks.Open("C:\Users\automatedreports\Desktop\Automated Reports\Hourly\Test1 Hourly Counts Auto")
On Error Resume Next
objExcel.DisplayAlerts=False
objExcel.Run("Test1_Hourly")
objExcel.DisplayAlerts=True
objWorkBook.Close True
Set objWorkBook = objExcel.Workbooks.Open("C:\Users\automatedreports\Desktop\Automated Reports\Hourly\Test2 Hourly Counts Auto")
On Error Resume Next
objExcel.DisplayAlerts=False
objExcel.Run("Test2_Hourly")
objExcel.DisplayAlerts=True
objWorkBook.Close False
objExcel.Quit
Set objWorkBook = Nothing
Set objExcel = Nothing