HighlanderSword Posted November 30, 2016 Share Posted November 30, 2016 Hello, I'm trying to open an xml file in excel using the code below $oExcel = _Excel_Open() $oExcel.Workbooks.OpenXML('Filename:="d:\test1.xml"', 'LoadOption:=XlXmlLoadOption.xlXmlLoadImportToList') I get the error message $oExcel.Workbooks.OpenXML('Filename:="D:\test1.xml"', 'LoadOption:=XlXmlLoadOption.xlXmlLoadImportToList') $oExcel.Workbooks^ ERROR. I have searched the forums and have not found any matched on how to open an xml file in Excel . Below is the Macro code when I record the steps to manually do it in excel, how do I do this using the Excel UDF ? Workbooks.OpenXML Filename:= "d:\test1.xml", LoadOption :=xlXmlLoadImportToList Link to comment Share on other sites More sharing options...
water Posted November 30, 2016 Share Posted November 30, 2016 AutoIt does not support named parameters. Needs to be something like this: ; XlXmlLoadOption Enumeration: https://msdn.microsoft.com/en-us/library/ff194637(v=office.14).aspx Global $xlXmlLoadImportToList = 2 ; Places the contents of the XML data file in an XML table $oExcel = _Excel_Open() $oExcel.Workbooks.OpenXML("d:\test1.xml", "", $xlXmlLoadImportToList) as described here: https://msdn.microsoft.com/en-us/library/ff838643(v=office.14).aspx My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
HighlanderSword Posted November 30, 2016 Author Share Posted November 30, 2016 Gives error "D:\Listing.au3" (12) : ==> The requested action with this object has failed.: $oExcel.Workbooks.OpenXML("D:\ysb.xlm", "", $xlXmlLoadImportToList) $oExcel.Workbooks^ ERROR ; XlXmlLoadOption Enumeration: https://msdn.microsoft.com/en-us/library/ff194637(v=office.14).aspx Global $xlXmlLoadImportToList = 2 ; Places the contents of the XML data file in an XML table $oExcel = _Excel_Open() $oExcel.Workbooks.OpenXML("D:\ysb.xlm", "", $xlXmlLoadImportToList) Link to comment Share on other sites More sharing options...
water Posted November 30, 2016 Share Posted November 30, 2016 Maybe (can't test at the momen): ; XlXmlLoadOption Enumeration: https://msdn.microsoft.com/en-us/library/ff194637(v=office.14).aspx Global $xlXmlLoadImportToList = 2 ; Places the contents of the XML data file in an XML table Global $oExcel = _Excel_Open() Global $oWorkbook = $oExcel.Workbooks.OpenXML("d:\test1.xml", Default, $xlXmlLoadImportToList) SkysLastChance 1 My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
HighlanderSword Posted November 30, 2016 Author Share Posted November 30, 2016 Thank You !!!!!!! that worked !!!!!!! Link to comment Share on other sites More sharing options...
water Posted November 30, 2016 Share Posted November 30, 2016 Glad you Like this solution My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
SkysLastChance Posted November 30, 2016 Share Posted November 30, 2016 Does it hurt to be that good water? You helped me out to thank you. You miss 100% of the shots you don't take. -Wayne Gretzky -Michael Scott Link to comment Share on other sites More sharing options...
SkysLastChance Posted November 30, 2016 Share Posted November 30, 2016 (edited) [double post] Edited November 30, 2016 by SkysLastChance double post You miss 100% of the shots you don't take. -Wayne Gretzky -Michael Scott Link to comment Share on other sites More sharing options...
water Posted December 1, 2016 Share Posted December 1, 2016 No, it doesn't hurt But it takes ages to become a genius Understanding Microsofts COM model is not easy, but writing Office UDFs like I did (Word, Excel, Outlook, ExcelChart) helps a lot SkysLastChance 1 My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now