Message popping up while running a chart from Visual Basic app

S

Sha

Hi,
I run reports in Excel(chart) from Visual Basic. It was working fin
when it was developed on NT Machine having Excel 2000. BUt now when th
application is moved onto XP Machine I have Excel 2002. Now when I ru
on XP Machine I get a message
"Microsoft Excel cannot find any data to replace.Check if your searc
formatting and criteria are defined correctly.If you are sure tha
matching data exists in this workbook,it may be on a protecte
sheet.Excel cannot replace data on a protected workseet".
The lines where I get this error message in code is
oleExcel.object.worksheets(XLS_SHEET_NAME).range("A1:"
"Z1539").Replace NULL_VALUE, ""

oleExcel.object.worksheets(XLS_SHEET_NAME).range("AA1:"
"AZ1539").Replace NULL_VALUE, ""

Null_value is a variable declared and has the value
Private Const NULL_VALUE = -9988998

So please let me know why is thsi happening on a XP Machine havin
Excel 2002.
Do I need to do any changes programatically. Please guide me.

Note: I get this message and then when I click the OK button the repor
runs fine.It doesn't hang anywhere. But I donot want to get thi
message in between.

Thanks in advance for your time.
bsc
 
T

Tushar Mehta

Do you get the same behavior if you do the same thing through the GUI
of XL2000 and 2002? If so, it might be an intentional change that MS
made with XL2002. You could try and add a
Application.DisplayAlerts=False before the replace method and a
Application.DisplayAlerts=True after.

--
Regards,

Tushar Mehta
www.tushar-mehta.com
Excel, PowerPoint, and VBA add-ins, tutorials
Custom MS Office productivity solutions
 
S

Sha

Hi Tushar Mehta,
Sorry for the delay.
But thanks for your help.

I have used the syntax that you have supplied and it worked fine fo
me.

Thanks once again for all of you.
bs
 

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