The office has a case management system that will export the filtered data to Excel. By default, it will create a workbook called 'Book1' and place all data filtered to 'Sheet1".
Up until recently, I have used the code below on a Windows 7 machine using Excel 2010. We are starting the upgrade process to prepare for end of life Windows 7 so am testing code in the Windows 10 environment.
The VBA macro that did work will error now in Windows 10. I tried running same code in Windows 10 using Excel 2016 but same problem. Here is the code:
The macro, excecuted from workbook AUDIT_BILLING.xlsm, pulls the data from the unsaved book and copies it to a sheet called 'DATA' in the AUDIT_BILLNG workbook.
This now errors out at the line:
Set oWb = GetObject("Book1")
With this error message:
[TABLE="width: 158"]
<tbody>[TR]
[TD="width: 211, bgcolor: transparent"]Run-time error '-2147221020(800401e4)':
[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]Automation error
[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]Invalid Syntax
[/TD]
[/TR]
</tbody>[/TABLE]
------------
Would appreciate any help/insight on this as we import a lot of data like this from the case management system, thanks
M
Up until recently, I have used the code below on a Windows 7 machine using Excel 2010. We are starting the upgrade process to prepare for end of life Windows 7 so am testing code in the Windows 10 environment.
The VBA macro that did work will error now in Windows 10. I tried running same code in Windows 10 using Excel 2016 but same problem. Here is the code:
Code:
SUB IMPORT_DATA ()
Dim oApp As Application
Dim oWb As Workbook
Set oWb = GetObject("Book1")
Set oApp = oWb.Parent
Windows("Audit_Billing.xlsm").Activate
'
With Workbooks("AUDIT_BILLING.xlsm").Worksheets("DATA") '<--| sheet name
Intersect(.Range(.Rows(1), .UsedRange.Rows(.UsedRange.Rows.Count)), .Range("A:I")).ClearContents
End With
'RESTOF CODE....
END SUB
This now errors out at the line:
Set oWb = GetObject("Book1")
With this error message:
[TABLE="width: 158"]
<tbody>[TR]
[TD="width: 211, bgcolor: transparent"]Run-time error '-2147221020(800401e4)':
[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]Automation error
[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]Invalid Syntax
[/TD]
[/TR]
</tbody>[/TABLE]
------------
Would appreciate any help/insight on this as we import a lot of data like this from the case management system, thanks
M
Last edited by a moderator: