Hi
I have, over the past 6 months, been maintaining VBA code based in an Excel 2010 workbook that references the MSXML library with no issues. Recently colleagues have upgraded from Windows 7 to Windows 8.1 and Office 2013 and these scripts now throw errors for them. To overcome this issue in the short term I now have two versions of the Workbook - one for each Windows version. I would dearly like to bring these two code bases back into one, but I cannot find any code that works on both versions. the original code looked something like this ....
Dim xDoc As DOMDocument Dim xNode as IXMLDOMElement [....] Set xNode = xDoc.SelectSingleNode("//Results") [....]
which worked fine on the Windows 7 / Office 2010 combination. When the issue arose, changeing the reference to DOMDocument60 worked on the Windows 8.1 / Office 2013 combination, but not on the Windows 7 / Office 2010 combination.
After investigation I established that the error being thrown was caused by the SelectSingleNode and SelectNodes methods were not returning results as expected - ie for Windows 7 any reference made to objects later than DOMDocument30, and for Windows 8.1 any other reference than DOMDocument 60.
Other parts of the code base that referenced other such versions caused similar problems.
Can anyone provide a way in which I can recode my VBA to work across both cominations without issues?
Thanks
Ian