PaulPerger
08-22-2017, 07:57 AM
I have several dozen pieces of VBA code that are used to process information by automatically entering data stored in an excel workbook into an Inventory System (IPMS).
More specifically, the Code is written in Word, where I provide some detail in Word (File Group # and which Excel document to get information from) and then RUN the code from Word. It then Opens the IPMS system to the appropriate menu, loads the data input screen and proceeds to grab data from the selected Excel file and input that data into the IPMS Inventory system. I also grab data from the screen in IPMS and input that into the Excel document so I know which lines of data were successfully entered, etc.
This process has worked VERY well for over a decade, but I was recently forced to upgrade to Office 2016 and now none of my VBA code that calls excel works properly. Commands are still sent to IPMS properly, but doing anything in Excel no longer works. Below is some code from one of my pieces of VBA code. For simplicity of identification, VBA Code is in BLUE text.
Same_Directory = xl.Application.ActiveWorkbook.Path - This command does not work at all. It does not return an error, "Same_Directory" is just left defined as "".
' Open Destruction Request Log and Find EOF Cell
xl.Application.Workbooks.Open (Same_Directory & "\Destruction Request Log.xls")
xl.Application.Range("G2").Select
' Switch to Current Destruction and Copy Info for Tally Sheet
xl.Application.Windows(CurrentDestruction).Activate
xl.Application.Range("AG1").Select
xl.Application.Cells(1, 33) = "=J5"
xl.Application.Cells(2, 33) = "EOF123"
xl.Application.Range("AG1").Select
xl.Application.Selection.Copy
None of this code works as it once did. "xl.Application." seems to no longer be a valid piece of code. I am hoping there is a simple piece of code to replace this as a "Find & Replace" would be a super easy fix.
Any help is MUCH appreciated!!
Thanks
More specifically, the Code is written in Word, where I provide some detail in Word (File Group # and which Excel document to get information from) and then RUN the code from Word. It then Opens the IPMS system to the appropriate menu, loads the data input screen and proceeds to grab data from the selected Excel file and input that data into the IPMS Inventory system. I also grab data from the screen in IPMS and input that into the Excel document so I know which lines of data were successfully entered, etc.
This process has worked VERY well for over a decade, but I was recently forced to upgrade to Office 2016 and now none of my VBA code that calls excel works properly. Commands are still sent to IPMS properly, but doing anything in Excel no longer works. Below is some code from one of my pieces of VBA code. For simplicity of identification, VBA Code is in BLUE text.
Same_Directory = xl.Application.ActiveWorkbook.Path - This command does not work at all. It does not return an error, "Same_Directory" is just left defined as "".
' Open Destruction Request Log and Find EOF Cell
xl.Application.Workbooks.Open (Same_Directory & "\Destruction Request Log.xls")
xl.Application.Range("G2").Select
' Switch to Current Destruction and Copy Info for Tally Sheet
xl.Application.Windows(CurrentDestruction).Activate
xl.Application.Range("AG1").Select
xl.Application.Cells(1, 33) = "=J5"
xl.Application.Cells(2, 33) = "EOF123"
xl.Application.Range("AG1").Select
xl.Application.Selection.Copy
None of this code works as it once did. "xl.Application." seems to no longer be a valid piece of code. I am hoping there is a simple piece of code to replace this as a "Find & Replace" would be a super easy fix.
Any help is MUCH appreciated!!
Thanks