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

Runtime Error '1004' - Specified value is out of range.

P: 63
I use VB6.0 and 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 #1
Share this Question
Share on Google+
2 Replies


debasisdas
Expert 5K+
P: 8,127
please run in debug mode and check whick line is creating the errror.
Jan 12 '08 #2

Expert 5K+
P: 8,434
amolbehl, I recommend you avoid using the names top, left or height for variables. These are the names of commonly used properties of various controls, and may cause confusion.

(Probably not related to this specific problem, though.)
Jan 13 '08 #3

Post your reply

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