Jump to content
Sign in to follow this  
FelixKan

About using autodiagram in Excel 2003 [Help!]

Recommended Posts

FelixKan

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 by FelixKan

Share this post


Link to post
Share on other sites
Authenticity

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

Share this post


Link to post
Share on other sites
FelixKan

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

Thanks 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).Select

but 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)^ ERROR

any idea...??

Share this post


Link to post
Share on other sites
FelixKan

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

Thanks 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).Select

but 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)^ ERROR

any idea...??

Share this post


Link to post
Share on other sites
Authenticity

OK, holding my finger :)

$oExcel.ActiveSheet.Shapes.AddShape(65, 0, 165,76.5, 25.5)

Share this post


Link to post
Share on other sites
FelixKan

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!!!!!!!

Share this post


Link to post
Share on other sites
Authenticity

heh glad to here it does.

Here is some paper with all the constants values and other things just in case you need it.

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×