473,396 Members | 1,833 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

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

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
2 4094
debasisdas
8,127 Expert 4TB
please run in debug mode and check whick line is creating the errror.
Jan 12 '08 #2
Killer42
8,435 Expert 8TB
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

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

Similar topics

6
by: Peter Frost | last post by:
Please help I don't know if this is possible but what I would really like to do is to use On Error Goto to capture the code that is being executed when an error occurs. Any help would be much...
0
by: Mark C | last post by:
All, I have used Excel automation many times in the past without error until now. My machine has both Access 97 and XP installed but this code is written in 97 and I am using Excel XP. The code...
0
by: zfraile | last post by:
I'm getting this error from the JIT compiler at runtime, but only on my boss' machine, not my development machine. I believe the error is generated from a call to an Excel object, but I can't tell...
4
by: dilau | last post by:
I have a problem. The error in subject appear when i run the macro Can u tell me why Case "CENTRALIZATOR SURVEY" Dim SHT As Object Set...
0
by: forgedascendant | last post by:
Good day everyone, I am new to this site so please forgive me if this post isn't completly correct. For the past 2 weeks I have been beating my head against the wall trying to figure out what is...
4
by: ielamrani | last post by:
Hi, I am getting this error when I try to export to an excel sheet. When I click on a button to export the first time it's fine, I rename the exported excel sheet and I try to export it again and I...
0
by: =?Utf-8?B?amtyYW1vczIwMDU=?= | last post by:
Hi, I had received some help earlier in the week with regards to writing a Change Macro for Excel. Now I am getting an error message and I wanted to confirm why. Below is the part of the code...
16
by: AFSSkier | last post by:
I have several cascading ComboBoxes & would like to close Cbo2 & open Cbo1 when there is an error. These CboBoxes are on an Excel spreadsheet, not a UserForm. I have the following code, if the...
0
by: CoreyReynolds | last post by:
Hey all, I have a piece of code that dumps a bunch of data into a spreadsheet. Also rearranges it into a pivot table and then graphs the pivot table as well so my boss can get a clear view of the...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.