FelixKan Posted January 27, 2009 Share Posted January 27, 2009 (edited) Hi, I am trying to use AutoIT3 (v. 3.3.0.0) to draw some flow charts in Excel 2003. However, I realize there is no udf which calls the .addshape() method, so I have to do it on my own...but failed.. could anybody help me out here and see what's wrong in my code? One thing which confuses me is, i could call the addline() method under the object Shapes but not the addshape(). I have searched MSDN but cant find a clue. Your help would be appreciated! Thanks for reading my post~ ;#include<excel.au3> $oExcel = ObjCreate("Excel.Application") With $oExcel .Visible = 1 .WorkBooks.Add .ActiveWorkbook.Sheets(1).Select () .cells.columnwidth=1.71 .activesheet.name="testing" EndWith ;$oExcel.Activesheet.Cells(1, 1).Value = 'testing!' $oExcel.ActiveSheet.Cells(1, 1).Select $oExcel.ActiveSheet.Shapes.AddLine(0, 0, 165, 165).Select $oExcel.ActiveSheet.Shapes.AddShape("msoShapeFlowchartPredefinedProcess", 0, 165,76.5, 25.5) Edited January 27, 2009 by FelixKan Link to comment Share on other sites More sharing options...
Authenticity Posted January 27, 2009 Share Posted January 27, 2009 Try this and tell me if it works because I don't have the library type atm to test it... no excel either lol. $oExcel.ActiveSheet.Shapes.AddShape("msoShapeFlowchartPredefinedProcess", 0, 165,76.5, 25.5).Select Link to comment Share on other sites More sharing options...
FelixKan Posted January 27, 2009 Author Share Posted January 27, 2009 Try this and tell me if it works because I don't have the library type atm to test it... no excel either lol.$oExcel.ActiveSheet.Shapes.AddShape("msoShapeFlowchartPredefinedProcess", 0, 165,76.5, 25.5).SelectThanks for your reply~ i have tried your suggestion:$oExcel = ObjCreate("Excel.Application") With $oExcel .Visible = 1 .WorkBooks.Add .ActiveWorkbook.Sheets(1).Select () .cells.columnwidth=1.71 .activesheet.name="testing" EndWith ;$oExcel.Activesheet.Cells(1, 1).Value = 'testing!' $oExcel.ActiveSheet.Cells(1, 1).Select $oExcel.ActiveSheet.Shapes.AddLine(0, 0, 165, 165).Select $oExcel.ActiveSheet.Shapes.AddShape("msoShapeFlowchartPredefinedProcess", 0, 165,76.5, 25.5).Selectbut still failed. My error message is:drawFlowChart.au3 (13) : ==> The requested action with this object has failed.:$oExcel.ActiveSheet.Shapes.AddShape("msoShapeFlowchartPredefinedProcess", 0, 165,76.5, 25.5).Select$oExcel.ActiveSheet.Shapes.AddShape("msoShapeFlowchartPredefinedProcess", 0, 165,76.5, 25.5)^ ERRORany idea...?? Link to comment Share on other sites More sharing options...
FelixKan Posted January 27, 2009 Author Share Posted January 27, 2009 Try this and tell me if it works because I don't have the library type atm to test it... no excel either lol.$oExcel.ActiveSheet.Shapes.AddShape("msoShapeFlowchartPredefinedProcess", 0, 165,76.5, 25.5).SelectThanks for your reply~ i have tried your suggestion:$oExcel = ObjCreate("Excel.Application") With $oExcel .Visible = 1 .WorkBooks.Add .ActiveWorkbook.Sheets(1).Select () .cells.columnwidth=1.71 .activesheet.name="testing" EndWith ;$oExcel.Activesheet.Cells(1, 1).Value = 'testing!' $oExcel.ActiveSheet.Cells(1, 1).Select $oExcel.ActiveSheet.Shapes.AddLine(0, 0, 165, 165).Select $oExcel.ActiveSheet.Shapes.AddShape("msoShapeFlowchartPredefinedProcess", 0, 165,76.5, 25.5).Selectbut still failed. My error message is:drawFlowChart.au3 (13) : ==> The requested action with this object has failed.:$oExcel.ActiveSheet.Shapes.AddShape("msoShapeFlowchartPredefinedProcess", 0, 165,76.5, 25.5).Select$oExcel.ActiveSheet.Shapes.AddShape("msoShapeFlowchartPredefinedProcess", 0, 165,76.5, 25.5)^ ERRORany idea...?? Link to comment Share on other sites More sharing options...
Authenticity Posted January 27, 2009 Share Posted January 27, 2009 OK, holding my finger $oExcel.ActiveSheet.Shapes.AddShape(65, 0, 165,76.5, 25.5) Link to comment Share on other sites More sharing options...
FelixKan Posted January 27, 2009 Author Share Posted January 27, 2009 OK, holding my finger $oExcel.ActiveSheet.Shapes.AddShape(65, 0, 165,76.5, 25.5)it WORKS perfectly!!!! thanks so so so so so much for your help!!!!!!! Link to comment Share on other sites More sharing options...
Authenticity Posted January 27, 2009 Share Posted January 27, 2009 heh glad to here it does.Here is some paper with all the constants values and other things just in case you need it. 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