autosc Posted February 12, 2007 Share Posted February 12, 2007 CODE$oExcel = ObjCreate("OWC11.spreadsheet") and then using the folowing to put values in cells : CODE.cells("9","3").value = "5000" puts in range C9 what is the coorect syntax to get Range "C9 " to autoit variable $myvar Link to comment Share on other sites More sharing options...
Locodarwin Posted February 12, 2007 Share Posted February 12, 2007 $myvar = $oExcel.Range("C9").Value -S (Yet Another) ExcelCOM UDF"A human being should be able to change a diaper, plan an invasion, butcher a hog, conn a ship, design a building, write a sonnet, balance accounts, build a wall, set a bone, comfort the dying, take orders, give orders, cooperate, act alone, solve equations, analyze a new problem, pitch manure, program a computer, cook a tasty meal, fight efficiently, die gallantly...[indent]...specialization is for insects." - R. A. Heinlein[/indent] Link to comment Share on other sites More sharing options...
autosc Posted February 12, 2007 Author Share Posted February 12, 2007 thanks ! you saved my day ! is there a way to load excel sheets partillay or fully to the Grid ? it seems hard ....some hints ? probably wit examples ?? Link to comment Share on other sites More sharing options...
Locodarwin Posted February 12, 2007 Share Posted February 12, 2007 The OWC spreadsheet is part of Office Web Controls and as such there is no straightforward way to load Excel workbooks into it. It's designed for embedded web applications and therefore isn't a full-featured workbook container object. There is, however, an option to export the spreadsheet to an Excel workbook. The OWC spreadsheet can be told to import data from a web page, a text file, or an XML file. It can also be told to connect to an external data source, i.e. a SQL database server. Barring these options, you're limited to copy & paste. If the spreadsheet data you're working on doesn't need to be embedded into a custom GUI, you might consider using the full Excel COM set. With it you can do basically anything Excel related. You can even hide Excel operations from the user and perform spreadsheet operations in the background. $oExcel = ObjCreate("Excel.Application") ; to use the full-fledged Excel object At the link in my signature you'll find a collection of functions that will allow you to perform numerous operations with Excel workbooks/sheets without having to know Excel COM. Good luck with your Excel endeavors! -S (Yet Another) ExcelCOM UDF"A human being should be able to change a diaper, plan an invasion, butcher a hog, conn a ship, design a building, write a sonnet, balance accounts, build a wall, set a bone, comfort the dying, take orders, give orders, cooperate, act alone, solve equations, analyze a new problem, pitch manure, program a computer, cook a tasty meal, fight efficiently, die gallantly...[indent]...specialization is for insects." - R. A. Heinlein[/indent] Link to comment Share on other sites More sharing options...
ptrex Posted February 12, 2007 Share Posted February 12, 2007 (edited) @autosclook at my "Excel Grid In AutoIT"And download the OWC help Reference OWC HelpfileThis might give you some hints.regardsptrex Edited February 12, 2007 by ptrex Contributions :Firewall Log Analyzer for XP - Creating COM objects without a need of DLL's - UPnP support in AU3Crystal Reports Viewer - PDFCreator in AutoIT - Duplicate File FinderSQLite3 Database functionality - USB Monitoring - Reading Excel using SQLRun Au3 as a Windows Service - File Monitor - Embedded Flash PlayerDynamic Functions - Control Panel Applets - Digital Signing Code - Excel Grid In AutoIT - Constants for Special Folders in WindowsRead data from Any Windows Edit Control - SOAP and Web Services in AutoIT - Barcode Printing Using PS - AU3 on LightTD WebserverMS LogParser SQL Engine in AutoIT - ImageMagick Image Processing - Converter @ Dec - Hex - Bin -Email Address Encoder - MSI Editor - SNMP - MIB ProtocolFinancial Functions UDF - Set ACL Permissions - Syntax HighLighter for AU3ADOR.RecordSet approach - Real OCR - HTTP Disk - PDF Reader Personal Worldclock - MS Indexing Engine - Printing ControlsGuiListView - Navigation (break the 4000 Limit barrier) - Registration Free COM DLL Distribution - Update - WinRM SMART Analysis - COM Object Browser - Excel PivotTable Object - VLC Media Player - Windows LogOnOff Gui -Extract Data from Outlook to Word & Excel - Analyze Event ID 4226 - DotNet Compiler Wrapper - Powershell_COM - New Link to comment Share on other sites More sharing options...
autosc Posted February 12, 2007 Author Share Posted February 12, 2007 @autosclook at my "Excel Grid In AutoIT"And download the OWC help Reference OWC HelpfileThis might give you some hints.regardsptrexLocodarwin : what about if i have sheets called , sheet 1 , sheet2 how should be the syntax $myvar = $oExcel.Range("C9").Value ? I am lost here ... Link to comment Share on other sites More sharing options...
Locodarwin Posted February 12, 2007 Share Posted February 12, 2007 Right, so in that case there are a couple of ways to go about returning info from the proper sheet. The first is to use the Sheets collection to directly address the proper sheet: $myvar = $oExcel.Sheets(x).Range("C9").Value oÝ÷ Ùh^ìb±©îêârö¥¹ê+jËkx'jg¢«¨µë+zÞ±éíx-ë!yëgºfÞ®v¦{*.Á©í¶që,N¬yÊ'w²ËhºÇä¡yëlreyËb¢{h©¶¬çʰj{ZrدzÇ¥yË^u·¢·«zÛ«)à¶«jxjëh×6 $oExcel.Sheets(x).Select $myvar = $oExcel.Range("C9").Value There are other ways as well. It's a matter of preference or effect as to which procedure you'll use. In my UDF collection, for example, the functions perform actions on the active sheet just to keep the logic flow simplified. Do a search for the file OWCDSS11.CHM on your system, open it, and browse through the "Programming Information" subheading for more information on how to use COM to interact with this component. Also consider using ptrex's "Excel Grid in AutoIt" solution, linked in his signature. His example demonstrates quite a few important techniques for using the grid. -S (Yet Another) ExcelCOM UDF"A human being should be able to change a diaper, plan an invasion, butcher a hog, conn a ship, design a building, write a sonnet, balance accounts, build a wall, set a bone, comfort the dying, take orders, give orders, cooperate, act alone, solve equations, analyze a new problem, pitch manure, program a computer, cook a tasty meal, fight efficiently, die gallantly...[indent]...specialization is for insects." - R. A. Heinlein[/indent] Link to comment Share on other sites More sharing options...
autosc Posted February 12, 2007 Author Share Posted February 12, 2007 Right, so in that case there are a couple of ways to go about returning info from the proper sheet. The first is to use the Sheets collection to directly address the proper sheet: $myvar = $oExcel.Sheets(x).Range("C9").Value oÝ÷ Ùh^ìb±©îêârö¥¹ê+jËkx'jg¢«¨µë+zÞ±éíx-ë!yëgºfÞ®v¦{*.Á©í¶që,N¬yÊ'w²ËhºÇä¡yëlreyËb¢{h©¶¬çʰj{ZrدzÇ¥yË^u·¢·«zÛ«)à¶«jxjëh×6 $oExcel.Sheets(x).Select $myvar = $oExcel.Range("C9").Value There are other ways as well. It's a matter of preference or effect as to which procedure you'll use. In my UDF collection, for example, the functions perform actions on the active sheet just to keep the logic flow simplified. Do a search for the file OWCDSS11.CHM on your system, open it, and browse through the "Programming Information" subheading for more information on how to use COM to interact with this component. Also consider using ptrex's "Excel Grid in AutoIt" solution, linked in his signature. His example demonstrates quite a few important techniques for using the grid. -S Locadarwin ; Not worked ! but your suggestions to check OWCDSS11.chm helped a lot . the solution was according to the refeerens >>> Spreadsheet1.Worksheets("Sheet2").Activate << and worked . But your udf is promising . I just run the examples . I wanted to use the grid in Gui . otherwise , your udf should be the best alternative , I guess . I tried to load Xml sheet and working ok . Thank you for your Guidance . PTREX : I wested a lot of time without exploring your grid . It was nice . But was a good idea if you add more examples , for example displaying a graph , and other methods . The link you showed me to MsdN , gave me a push in my learning. Thank you ! Link to comment Share on other sites More sharing options...
Locodarwin Posted February 13, 2007 Share Posted February 13, 2007 That's yet another way. It should still work as I stated, though - perhaps something is lost in the translation. An example using your solution: #include <GUIConstants.au3> $oExcel = ObjCreate("OWC11.spreadsheet") GuiCreate("Excel Object", 802, 590, -1, -1, $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS) $GUI_ActiveX = GUICtrlCreateObj ($oExcel, 10, 10 , 780 , 550) $oExcel.Worksheets("Sheet2").Activate $oExcel.Range("C9").Value = "Dude!" Sleep(5000) Exit oÝ÷ Ø ÞÅ©©ë¬x(ê+(ëb¢{ºÚ"µÍÚ[ÛYH ÑÕRPÛÛÝ[Ë]LÉÝÂÌÍÛÑ^Ù[HØÜX]J ][ÝÓÕÐÌLKÜXYÚY] ][ÝÊBÝZPÜX]J ][ÝÑ^Ù[ØXÝ ][ÝË NLLKLK ÌÍÕÔ×ÓÕTTQÒSÕÈ È ÌÍÕÔ×ÕTÒPH È ÌÍÕÔ×ÐÓTÒPSÔÊBÌÍÑÕRWÐXÝ]VHÕRPÝÜX]SØ ÌÍÛÑ^Ù[LL Î ML BÌÍÛÑ^Ù[ÚY]Ê ][ÝÔÚY]][ÝÊKÙ[XÝÌÍÛÑ^Ù[[ÙJ ][ÝÐÎI][ÝÊK[YHH ][ÝÑYIÌÌÎÉ][ÝÂÛY L B^] Both of these work for me. -S (Yet Another) ExcelCOM UDF"A human being should be able to change a diaper, plan an invasion, butcher a hog, conn a ship, design a building, write a sonnet, balance accounts, build a wall, set a bone, comfort the dying, take orders, give orders, cooperate, act alone, solve equations, analyze a new problem, pitch manure, program a computer, cook a tasty meal, fight efficiently, die gallantly...[indent]...specialization is for insects." - R. A. Heinlein[/indent] 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