SlimShady Posted September 21, 2005 Posted September 21, 2005 (edited) I want to mimic a grid by integrating an Excel sheet. But I can't make it work. If you have a working example, please share. Here's my current script. expandcollapse popup#include <GUIConstants.au3> Opt('OnExitFunc', 'Error') GUICreate("Test", 200, 200) $oExcel = ObjCreate("Excel.Application") ; Create an Excel Object GUISetState() If IsObj ($oExcel) Then GUICtrlCreateObj($oExcel, 0, 0, 150, 150) ;$oExcel.Visible = 1 ; Let Excel show itself $oExcel.WorkBooks.Add ; Add a new workbook $oExcel.ActiveWorkBook.ActiveSheet.Cells(1,1).Value="test"; Fill a cell $oExcel.ActiveWorkBook.Saved = 1 ; Simulate a save of the Workbook Else Exit(@ScriptLineNumber) EndIf #cs Do Sleep(25) Until NOT $oExcel.Application.Visible $oXLApp = 0 Exit #ce Do Sleep(25) $msg = GUIGetMsg() Until $msg = $GUI_EVENT_CLOSE $oExcel.Quit Func Error() $LineNum = @exitCode If $LineNum > 0 Then MsgBox(48, 'AutoIt Error', 'Script failed at line number ' & $LineNum & '.') EndFunc Edited September 21, 2005 by SlimShady
ReFran Posted September 21, 2005 Posted September 21, 2005 (edited) Mmmmh .... ...... perhaps far away from that what you wanted, but it should be possible using an extra DLL. Some weeks ago I saw a discussion to view IE pages on a GUI with a special DLL. I tested it with PDFs, works fine. Should also work with Excel files. HTH, Reinhard Edited September 21, 2005 by ReFran
seandisanti Posted September 21, 2005 Posted September 21, 2005 Mmmmh .......... perhaps far away from that what you wanted, but it should be possible using an extra DLL. Some weeks ago I saw a discussion to view IE pages on a GUI with a special DLL. I tested it with PDFs, works fine. Should also work with Excel files.HTH, Reinhardcould you post the code you used to embed pdf's? i think that's something that could be useful to others in the future
ReFran Posted September 21, 2005 Posted September 21, 2005 Hi,attached the code. It works also with an xls file, but it is slow, because Excel starts up so slow. So with xls it would be better to use a xls-viewer.Please search here for the extra dll "cwebpage" you need to execute the code.Best regards, Reinhard#include "GUIConstants.au3"$dll = DLLOpen("cwebpage.dll")$hwnd = GUICreate("Browzer",600,600,-1,-1,$WS_SIZEBOX+$WS_SYSMENU)$pos = WinGetClientSize($hwnd)DLLCall($dll,"long","EmbedBrowserObject","hwnd",$hwnd)GUISetState()DLLCall($dll,"long","DisplayHTMLPage","hwnd",$hwnd,"str","file://c:\Test.pdf")While 1 $msg = GUIGetMsg() If $msg = -3 Then ExitLoop $newpos = WinGetClientSize($hwnd) If Not @error And $newpos[0] <> $pos[0] And _ $newpos[1] <> $pos[1] Then $pos = $newpos DLLCall($dll,"none","ResizeBrowser","hwnd",$hwnd,"int",$pos[0],"int",$pos[1]) EndIfWEnd$ret = DLLCall($dll,"long","UnEmbedBrowserObject","hwnd",$hwnd)
GioVit Posted September 22, 2005 Posted September 22, 2005 see this link: http://www.autoitscript.com/forum/index.ph...271entry87271
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