Hi,
I'm trying to get the AppVersion from this app.xml from Excel 2010, but it results in "Object reference not set to an instance of an object."
My (simple) code:Code:<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <Properties xmlns="http://schemas.openxmlformats.org/officeDocument/2006/extended-properties" xmlns:vt="http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes"> <Application>Microsoft Excel</Application> <DocSecurity>0</DocSecurity> <ScaleCrop>false</ScaleCrop> <HeadingPairs><vt:vector size="2" baseType="variant"><vt:variant><vt:lpstr>Werkbladen</vt:lpstr></vt:variant><vt:variant><vt:i4>3</vt:i4></vt:variant></vt:vector></HeadingPairs> <TitlesOfParts><vt:vector size="3" baseType="lpstr"><vt:lpstr>Blad1</vt:lpstr><vt:lpstr>Blad2</vt:lpstr><vt:lpstr>Blad3</vt:lpstr></vt:vector></TitlesOfParts> <Company>Home</Company> <LinksUpToDate>false</LinksUpToDate> <SharedDoc>false</SharedDoc> <HyperlinksChanged>false</HyperlinksChanged> <AppVersion>14.0300</AppVersion> </Properties>
I have used it before in my own custom created xml files without any issues. Don't understand why this doesn't work.Code:Dim docversion = XElement.Load(Application.StartupPath & "\app.xml") MsgBox(docversion.Descendants("AppVersion").Nodes(0).ToString)
Any help much appreciated.





Reply With Quote