PDA

View Full Version : VBA code of Excel 2013 is not working in Excel 2010



Piyush
04-23-2015, 01:42 AM
Dear,
Can anybody know why VBA code of Excel 2013 "workbooks.open" not working with Excel 2010?
I found below error. Please let me know.
Error 1: System Error &H80070BBC (-2147021892).
Error 2: Run-timeerror '-2147021892 (80070bbc)':
Automation error
An AddJob call was not issued.
Please find below code that is working fine with Excel 2013 where give errors in Excel 2010
---------------------------------------------------------------------------------------------------------

Sub Update_Click()
Dim path As String
Dim currentWb As Workbook
Dim openWb As Workbook
Dim openWs As Worksheet
path = "C:\Users\20049467\Desktop\KP-I1-0201.xls"

Set currentWb = ThisWorkbook
Set openWb = Workbooks.Open(path)
Set openWs = openWb.Sheets("Cable_Schedule")
openWs.Range("L6") = currentWb.Sheets("Document List").Range("B2")
openWs.Range("L7") = currentWb.Sheets("Document List").Range("C2")
openWs.Range("E19") = currentWb.Sheets("Document List").Range("D6")
ActiveWorkbook.Save

openWb.Close (False)
ActiveSheet.Shapes("CCS").ControlFormat.Value = 0

End Sub
13241
13242

Aflatoon
04-23-2015, 02:54 AM
I can't see anything there that would be incompatible. Is there any code in the workbook you are opening?

Kenneth Hobs
04-23-2015, 06:09 AM
Try opening the file manually. If it has Protected View, then you might want to look explore turning it off, but it could be a risk. http://www.webtlk.com/2010/01/04/how-to-turn-off-protected-view-in-office-2010/

Piyush
04-23-2015, 11:28 PM
I can't see anything there that would be incompatible. Is there any code in the workbook you are opening?

There is no code in the workbook that I am opening.

Piyush
04-23-2015, 11:30 PM
Hi Kenneth Hobs,
Thanks for Reply.
I tried to opening file manually. There is not any protected view. It open normally.
Kindly try to copy this code in Excel VBA 2010 and try to run.
THanks again.

Robert_Hind
05-04-2015, 06:12 PM
Is it possible that you have the wrong references set? Remember that if there are references set to Excel or other office components the references will be updated to the newer version which will then cause a problem when you use the same vba code in an earlier version.

Because our organisation has different versions of excel opening the same spreadsheets we use code to reset the references and in some instances use late binding instead of early binding when referencing other applications.