By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,594 Members | 2,059 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,594 IT Pros & Developers. It's quick & easy.

add AUTOSHAPES to excel doc in VB 6.0

P: 63
Hi,

Can anyone tell me how to add AUTOSHAPES to excel via VB Code???
Dec 26 '07 #1
Share this Question
Share on Google+
4 Replies


Dököll
Expert 100+
P: 2,364
Hi,

Can anyone tell me how to add AUTOSHAPES to excel via VB Code???
I am not sure how this can be done, amolbehl... Do stay tuned for added support. Will let you know I happen to see something:-)

Updated your title, hope you don't mind; helps you get better hits...

In a bit!
Dec 27 '07 #2

P: 63
ok I found the solution to my problem now I have another problem. When I execute the code I have given below, I get runtime Error 1004 - Specified value is out of range.

Expand|Select|Wrap|Line Numbers
  1. Set oXL = CreateObject("Excel.Application")
  2.     oXL.Visible = True
  3.     Set oWB = oXL.Workbooks.Add
  4.     oWB.Windows.Application.Visible = true
  5.     Set oSheet = oWB.ActiveSheet
  6.     oSheet.Name = "TEST"
  7.     oSheet.Visible = xlSheetVisible
  8.  
  9.     Dim left As Single
  10.     Dim top As Single
  11.     Dim wide As Single
  12.     Dim height As Single
  13.  
  14.     left = 100
  15.     top = 100
  16.     wide = 100
  17.     height = 100
  18.  
  19.     oSheet.Shapes.AddShape msoShapeRectangle, left, top, wide, height
  20.  
Can anyone help me to solve this error.

What are the appropriate values for left,top and wide and height?
Jan 12 '08 #3

QVeen72
Expert 100+
P: 1,445
Hi,

The Co=Ordinates are OK, but the Code is :

Expand|Select|Wrap|Line Numbers
  1. oSheet.Shapes.AddShape(msoShapeRectangle, 100, 100, 100, 100).Select
  2.  

Regards
Veena
Jan 12 '08 #4

P: 63
Thanx a lot.


I had another question .... the image I insert has to be in a position relative to cell no. At one time it might be way down and other times it may be way up.

Is there anyway to set the coord in terms of cells ... I mean some kind of mapping from cells to points (Coordinates) ??
Jan 24 '08 #5

Post your reply

Sign in to post your reply or Sign up for a free account.