AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Converting XLSX to CSV using COM

 
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
philz



Joined: 05 Jun 2007
Posts: 89
Location: USA

PostPosted: Mon Aug 11, 2008 2:57 am    Post subject: Converting XLSX to CSV using COM Reply with quote

I'm Using the COM library.
It's Quite cool, the only wish I could have for it is to not have to do those nested com_invoke functions for objects. I've only tested it using Excel 2007, although the object library is similar to previous versions.

Three Questions I have

    Is it possible to do something like this COM_invoke(excel, "worksheets(2).select")
    How can I do error handling (click cancel on a prompt to overwrite msgbox and you'll know what I mean
    I keep getting orphaned Excel Processes. how can i kill those without using process, close, excel.exe


Here is the code

Code:

COM_CoInitialize()

loop, f:\documents\test\*.xlsx
{
regexmatch(a_loopfilelongpath, ".*\.", savename)
savename := savename "csv"
excel := com_createobject("excel.application")
com_invoke(com_invoke(excel,"Workbooks"),"open",a_loopfilelongpath)
com_invoke(com_invoke(excel, "activeworkbook"),"Saveas", savename, 6) ;saves as a csv
com_invoke(com_invoke(excel, "activeworkbook"), "Close", False)
com_invoke(excel,"quit")
}



Any help is much appreciated
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group