Macro compatibility with Excel 97

G

Guest

Hi,

Can someone help me.
I created excel macros in Excel 2000, however when the macro is opened with
Excel 97 some errors occur. These are some of them:

1.The following command gives RunTime error '1004'
Unable to set the ColorIndex of property of the Interior Class
Sheet13.Cells(StartRow + Row, StartColumn + Column).Interior.ColorIndex = 0

Is there any equivalant code in Excel 97 for the above command?
Why the macro caused error in 97, but not in 2000? Was Interior class not
part of worksheet member?

2. The application terminates automatically when a part of macro is executed
and the following message is displayed on the error dialog box:
"<process has already exit> has generated errors and will be closed by
Windows. You will need to restart the program. An error log is being created."

What is the cause of this error? Where can I find the error log?
I tried to put somebreak points to trace the problem, however the error did
not come out during the debug mode. It only came during run time. Why Excel
2000 doesn't have the problem?

Your help is appreciated.

Regards,
Chris
 
J

Jim Cone

Question 1. There is no colorindex value of 0 (zero) in xl97, xl2000 or xl 2002..
Question 2. Post your code.
The error log could be referring to the "Event" log that windows maintains.
That won't be any help.
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware


"Chris L"
<[email protected]>
wrote in message
Hi,
Can someone help me.
I created excel macros in Excel 2000, however when the macro is opened with
Excel 97 some errors occur. These are some of them:

1.The following command gives RunTime error '1004'
Unable to set the ColorIndex of property of the Interior Class
Sheet13.Cells(StartRow + Row, StartColumn + Column).Interior.ColorIndex = 0

Is there any equivalant code in Excel 97 for the above command?
Why the macro caused error in 97, but not in 2000? Was Interior class not
part of worksheet member?

2. The application terminates automatically when a part of macro is executed
and the following message is displayed on the error dialog box:
"<process has already exit> has generated errors and will be closed by
Windows. You will need to restart the program. An error log is being created."

What is the cause of this error? Where can I find the error log?
I tried to put somebreak points to trace the problem, however the error did
not come out during the debug mode. It only came during run time. Why Excel
2000 doesn't have the problem?

Your help is appreciated.

Regards,
Chris
 
G

Guest

I've tried to replace the value to 1, or replacing the command from
ColorIndex to Color but they stills give the same error.
'Sheet13.Cells(RowMain + Row, ColumnMain + Column).Interior.Color = RGB(126,
255, 126) 'Grey

These are the codes that makes the application terminates:
Sub ClearItem(StartRow As Integer, StartColumn As Integer, Optional Unused
As Boolean = False)
Dim Row, Column
For Row = 1 To 20 Step 1
For Column = 1 To 16 Step 1
Sheet14.Cells(StartRow + Row, StartColumn + Column) = 0
'clear the status in main worksheet
If Unused = False Then

'Any of the following commands terminates Excel 97 in run time
'If breakpoint and Stepover are used, there's no problem
Sheet13.Range("B41") = "Standard"
Sheet13.Range("C41") = ""


End If
Next Column
Next Row

End Sub

Regards,
Chris
 
J

Jim Cone

Some questions, ideas, suggestions...

Does "Sheet13" exist?
Try replacing it with the actual worksheet name...
Worksheets("Real Name").Range("B41").Value

"Row" has its own meaning in Excel, don't use it as a variable name.

Could StartRow + Row or RowMan + Row exceed the number of rows?
(same for columns)

Try using the default property for the ranges instead of relying on Excel...
Sheet13.Range("B41").Value = "Standard"

Copy the module code out to Notepad, delete the module and replace
it with a new one.

Jim Cone
San Francisco, USA
http://www.officeletter.com/blink/specialsort.html



"Chris L" <[email protected]>
wrote in message
I've tried to replace the value to 1, or replacing the command from
ColorIndex to Color but they stills give the same error.
'Sheet13.Cells(RowMain + Row, ColumnMain + Column).Interior.Color = RGB(126,
255, 126) 'Grey

These are the codes that makes the application terminates:
Sub ClearItem(StartRow As Integer, StartColumn As Integer, Optional Unused
As Boolean = False)
Dim Row, Column
For Row = 1 To 20 Step 1
For Column = 1 To 16 Step 1
Sheet14.Cells(StartRow + Row, StartColumn + Column) = 0
'clear the status in main worksheet
If Unused = False Then

'Any of the following commands terminates Excel 97 in run time
'If breakpoint and Stepover are used, there's no problem
Sheet13.Range("B41") = "Standard"
Sheet13.Range("C41") = ""


End If
Next Column
Next Row

End Sub

Regards,
Chris
 
G

Guest

Hi again,

I tried to replace "Range" with "Cells" and the application doesn't
terminates anymore. It's very strange though,... the syntax are valid and it
doesn't seem to be any mistakes.

I still cannot solve the Interior Class problem (Color/ColorIndex), does
anyone know how to change the cell color with macro in Excel 97?

Regards,
Chris
 
J

Jim Cone

Is the sheet protected?
Jim Cone


"Chris L" <[email protected]>
wrote in message
Hi again,
I tried to replace "Range" with "Cells" and the application doesn't
terminates anymore. It's very strange though,... the syntax are valid and it
doesn't seem to be any mistakes.
I still cannot solve the Interior Class problem (Color/ColorIndex), does
anyone know how to change the cell color with macro in Excel 97?
Regards,
Chris
 
G

Guest

No, it's not protected.
Anyway, as replacing "Range" to "Cells" prevents it from crashing,
I'm happy with it.
Thank you for your assistance.

Regards,
Chris
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top