Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Runtime Error 1004 -- Application Defined or Object Defined Error

Hi,

I coded a VBA macro in an Excel 97 workbook that imports
data from several diferent excel 97 workbooks into the one
master book (master book contains the macro).

We are now in the process of migrating to Office XP. When
the macro is run in XP, I recieve the following error:

"Runtime Error 1004 -- Application Defined or Object
Defined Error"

The macro ran error free for several months in 97, so I am
confident that this error is due to the change in version.

Any suggestions or ideas on what could be causing this
error?

Thanks.

John.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Runtime Error 1004 -- Application Defined or Object Defined Error

Hi,

Sorry for the delay, this obviously would have helped.
When stepping through the application the error appears
when the following line of code is executed:

ThisWorkbook.sheets(SheetName).Cells(Row, Col) = value

John.

-----Original Message-----
When you get the error, what is the line of code that is

highlighted?

You should begin by looking at the line.

--
Regards,
Tom Ogilvy

"John" wrote in message
...
Hi,

I coded a VBA macro in an Excel 97 workbook that imports
data from several diferent excel 97 workbooks into the

one
master book (master book contains the macro).

We are now in the process of migrating to Office XP.

When
the macro is run in XP, I recieve the following error:

"Runtime Error 1004 -- Application Defined or Object
Defined Error"

The macro ran error free for several months in 97, so I

am
confident that this error is due to the change in

version.

Any suggestions or ideas on what could be causing this
error?

Thanks.

John.



.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Runtime Error 1004 -- Application Defined or Object Defined Error

if sheetname didn't refer to a valid sheet, you would get a subscript out of
range, so I think we can assume that isn't the source

Therefore the Row or Col argument seems likely.

Sub Tester1()
Value = 10
Row = 0
col = 6
sheetname = "Sheet1"
ThisWorkbook.Sheets(sheetname).Cells(Row, col) = Value
End Sub

gives me that error - a value of zero for row is not legal.

Sub Tester1()
Value = 10
Row = 10
col = 0
sheetname = "Sheet1"
ThisWorkbook.Sheets(sheetname).Cells(Row, col) = Value
End Sub

gives me the error - col = 0 is not legal.

Perhaps put this before the offending line

msgbox "row: " & row & " col: " & col

It is possible that using row can be problematic in xl2002, but I doubt it.
More than likely, something has changed so that either row or col is not
getting proper value. Since these are variable, there must be some code
that are assigning them a value.

--
Regards,
Tom Ogilvy


John wrote in message
...
Hi,

Sorry for the delay, this obviously would have helped.
When stepping through the application the error appears
when the following line of code is executed:

ThisWorkbook.sheets(SheetName).Cells(Row, Col) = value

John.

-----Original Message-----
When you get the error, what is the line of code that is

highlighted?

You should begin by looking at the line.

--
Regards,
Tom Ogilvy

"John" wrote in message
...
Hi,

I coded a VBA macro in an Excel 97 workbook that imports
data from several diferent excel 97 workbooks into the

one
master book (master book contains the macro).

We are now in the process of migrating to Office XP.

When
the macro is run in XP, I recieve the following error:

"Runtime Error 1004 -- Application Defined or Object
Defined Error"

The macro ran error free for several months in 97, so I

am
confident that this error is due to the change in

version.

Any suggestions or ideas on what could be causing this
error?

Thanks.

John.



.



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Runtime Error 1004 -- Application Defined or Object Defined Error

I would agree, row and col would seem to be the obvious
source of the issue, however this works and has worked
fine in Excel 97 for months.

I'm tempted to re-code the problem area in XP and see if
it works. Unfortuneatley I had no control over the now-
owner of the app migrating to XP from 97. Thats a large
version gap, and I knew there would be issues...

Thanks for the input.
John

-----Original Message-----
if sheetname didn't refer to a valid sheet, you would get

a subscript out of
range, so I think we can assume that isn't the source

Therefore the Row or Col argument seems likely.

Sub Tester1()
Value = 10
Row = 0
col = 6
sheetname = "Sheet1"
ThisWorkbook.Sheets(sheetname).Cells(Row, col) = Value
End Sub

gives me that error - a value of zero for row is not

legal.

Sub Tester1()
Value = 10
Row = 10
col = 0
sheetname = "Sheet1"
ThisWorkbook.Sheets(sheetname).Cells(Row, col) = Value
End Sub

gives me the error - col = 0 is not legal.

Perhaps put this before the offending line

msgbox "row: " & row & " col: " & col

It is possible that using row can be problematic in

xl2002, but I doubt it.
More than likely, something has changed so that either

row or col is not
getting proper value. Since these are variable, there

must be some code
that are assigning them a value.

--
Regards,
Tom Ogilvy


John wrote in message
...
Hi,

Sorry for the delay, this obviously would have helped.
When stepping through the application the error appears
when the following line of code is executed:

ThisWorkbook.sheets(SheetName).Cells(Row, Col) = value

John.

-----Original Message-----
When you get the error, what is the line of code that

is
highlighted?

You should begin by looking at the line.

--
Regards,
Tom Ogilvy

"John" wrote in message
...
Hi,

I coded a VBA macro in an Excel 97 workbook that

imports
data from several diferent excel 97 workbooks into

the
one
master book (master book contains the macro).

We are now in the process of migrating to Office XP.

When
the macro is run in XP, I recieve the following

error:

"Runtime Error 1004 -- Application Defined or Object
Defined Error"

The macro ran error free for several months in 97,

so I
am
confident that this error is due to the change in

version.

Any suggestions or ideas on what could be causing

this
error?

Thanks.

John.


.



.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Run-time error '50290': Application-defined or object-defined erro Macro button Excel Discussion (Misc queries) 1 March 12th 09 10:59 AM
Application-defined or object-defined error Please Help [email protected] Excel Discussion (Misc queries) 1 April 3rd 06 01:00 PM
Macro error : Application-defined or object-defined error Joe Excel Discussion (Misc queries) 3 January 27th 06 02:32 PM
VBA - Application-defined or object-defined error tina salgia Excel Programming 0 August 24th 03 10:35 PM
VBA - Application-defined or object-defined error Chip Pearson Excel Programming 0 August 24th 03 08:43 PM


All times are GMT +1. The time now is 01:01 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"