Welcome to the SRP Forum! Please refer to the SRP Forum FAQ post if you have any questions regarding how the forum works.

Converting Code from VBA to OI

I am trying to convert the following vba code to OI

ActiveSheet.Shapes.AddPicture("H:\Revsoft\OI92\bmps\test.jpg", False, True, -1, -1, -1, -1).Select

Any suggestions?

Comments

  • Assuming you already have instantiated the ActiveSheet object, the code would look something like this. (This code has not been tested):
    objShapes = OleGetProperty(objActiveSheet, "Shapes") If OleStatus() then Error = "Could not get the Shapes collection." end else objPicture = OleCallMethod(objShapes, "AddPicture", "H:\Revsoft\OI92\bmps\test.jpg", 0, 1, -1, -1, -1, -1) If OleStatus() then Error = "Could not add picture." end else OleCallMethod(objPicture, "Select") If OleStatus() then Error = "Could not select picture." end end end Hope that gets you started on the wrong foot.
  • Thank you Kevin,
    I solved it in the mean time, but this helped for other stuff i am doing too.
    I still need to comprehend when to use the method and when to use property commands.
    My next problem is creation of borders.
    I got the range and the border objects working, but i am fighting to get to the different edges so i can put the other properties.
    If you have any suggestions let me know.

    And once more thanks for the hint.
  • I don't have any suggestions at this mostly because I'm not familiar with the Excel automation API. If you have code, I'd be happy to see if anything stands out.
Sign In or Register to comment.