xuzo Posted March 31, 2017 Posted March 31, 2017 Trying to run an example file but I don't have MS Office, only open office calc. What code should I substitute in there so this script runs with open office? expandcollapse popup#include <MsgBoxConstants.au3> ; COM Test file ; ; Excel Automation Example ; Local $oMyExcel = ObjCreate("Excel.Application") ; Create an Excel Object If @error Then MsgBox($MB_SYSTEMMODAL, "ExcelTest", "Error creating the Excel Object. Error code: " & @error) Exit EndIf If Not IsObj($oMyExcel) Then MsgBox($MB_SYSTEMMODAL, "ExcelTest", "I'm sorry, but creation of the Excel object failed.") Exit EndIf $oMyExcel.Visible = 1 ; Let the guy show himself $oMyExcel.workbooks.add ; Add a new workbook ; Example: Fill some cells MsgBox($MB_SYSTEMMODAL, "", "Click 'ok' to fill some cells") Local $i Local $j With $oMyExcel.activesheet For $i = 1 To 15 For $j = 1 To 15 .cells($i, $j).value = $i Next Next MsgBox($MB_SYSTEMMODAL, "", "Click 'ok' to clear the cells") .range("A1:O15").clear EndWith Sleep(2000) $oMyExcel.activeworkbook.saved = 1 ; To prevent 'yes/no' questions from Excel $oMyExcel.quit ; Get rid of him. MsgBox($MB_SYSTEMMODAL, "ExcelTest", "Is Excel gone now ?") ; Nope, only invisible, ; but should be still in memory. $oMyExcel = "" ; Only now Excel is removed from memory. Exit
water Posted March 31, 2017 Posted March 31, 2017 You can't compare Excel and oOCalc. Best is to rewrite your script using the OpenOffice UDF as described here: https://www.autoitscript.com/wiki/User_Defined_Functions#OpenOffice.2FLibreOffice 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
Skysnake Posted March 31, 2017 Posted March 31, 2017 I generate CSVs which OpenOffice opens effortlessly. Skysnake Why is the snake in the sky?
xuzo Posted March 31, 2017 Author Posted March 31, 2017 I want to use all the example files , they are all excel... Isn't there a quick find and replace I can do in the example files so they work with open calc?
water Posted March 31, 2017 Posted March 31, 2017 No. Excel and oO do not work the same way. So a simple f&r isn't possible. 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
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