I am wanting to let viewers know why a refreshable spreadsheet did not refresh. Often times its an ODBC time out error - I put an error handler into the macro that runs the refresh - so that it will select a specific worksheet, specific cell and put the current date in. I would also like to have the error message that pops up when there is a problem to populate the cell next to the date...how do i do this?
I am basically trying to cover my tracks - this particular report seems to fail a lot - due to these ODBC time outs, but the average joe just sees the report not working - so If I can show them it's not the report....I can maybe get them off my back and maybe even get my IT department to realize ...its the server...not the report.
Thanks for any help - the quicker the better =)
Sophie
4 1724
...I would also like to have the error message that pops up when there is a problem to populate the cell next to the date...how do i do this? ...
Use "on error resume next" to avoid the message errors to popup, then write err.number and err.description in the cell you want, and then dont forget to clean the err.number. this little example will populate the first 5 cells of column A with some numbers that are suposed to be short integers (any number above 33,000 will overflow it), and the errors in column B. - sub test()
-
dim i as integer
-
dim j as integer
-
on error resume next 'dont bother us with each error
-
i = "hello world"
-
cells(1,1) = i
-
cells(1,2) = err.number & " " & err.description
-
err.clear
-
for j = 2 to 5
-
i= int ( rnd * 60000)
-
cells(j,1) = i
-
cells(j,2) = err.number & " " & err.description
-
err.clear 'always make sure to clean it, this way if next number has no error, it wont show the previous one.
-
next
-
end sub
HTH
Use "on error resume next" to avoid the message errors to popup, then write err.number and err.description in the cell you want, and then dont forget to clean the err.number. this little example will populate the first 5 cells of column A with some numbers that are suposed to be short integers (any number above 33,000 will overflow it), and the errors in column B. - sub test()
-
dim i as integer
-
dim j as integer
-
on error resume next 'dont bother us with each error
-
i = "hello world"
-
cells(1,1) = i
-
cells(1,2) = err.number & " " & err.description
-
err.clear
-
for j = 2 to 5
-
i= int ( rnd * 60000)
-
cells(j,1) = i
-
cells(j,2) = err.number & " " & err.description
-
err.clear 'always make sure to clean it, this way if next number has no error, it wont show the previous one.
-
next
-
end sub
HTH
Thanks! I'll give it a shot!
There's a statement in VB6 that you can use to raise a specified error, without having to actually do something wrong. I think it's Error. It might not exist in VBA, of course.
There's a statement in VB6 that you can use to raise a specified error, without having to actually do something wrong. I think it's Error. It might not exist in VBA, of course.
It's very much present in VBA too, and the format is:
Err.Raise [Number], [Source], [Description]
Sign in to post your reply or Sign up for a free account.
Similar topics
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...
|
by: IMS.Rushikesh |
last post by:
Hi All,
I am trying to execute below code but it gives me an COMException
///// Code Start ////
public string GetName(Excel.Range range)
{
try
{
if (range.Name != null)
|
by: jereme.goblue |
last post by:
The web page at http://www.rossowinspections.com/ has an issue with the
left menu. The left menu has 7 links. One of the links doesn't work.
Using Firefox 1.5 the Fees link isn't a clickable...
|
by: Frank M. Walter |
last post by:
Hello,
I have made an small AddIn with udf for excel 2003.
I use vs2003.
The point of view is the function __T()
I call it in excel sheet writing =__T()
I am not able to set a value to a...
|
by: bob |
last post by:
Now this ought to be a simple matter. But nothing's simple in the Net
world, I'm finding.
In vb6 you could use "!" to force text to upper case in the format
function. I've searched the vb.net...
|
by: Abdhul Saleem |
last post by:
Hi,
I am recieving error ActiveX component can't create object in the following
line in the asp page.
set ExcelApp = CreateObject("Excel.Application")
Previously this code was working fine....
|
by: James Hallam |
last post by:
Hi,
I'm having trouble getting a conditional force (namely friction) using
VB6. I have had no problem using constant or periodic forces. The
trouble seems to be that when defining the later...
|
by: htperth |
last post by:
Hi all,
Note that I'm new to LDAP and Active Directory and am writing an application that retrieves a simple phone list for all the users in our domain. So far I have the following console app...
|
by: abdoelmasry |
last post by:
hi profs
i have PDC, i am trying to ad another domain in the same forest.
i alway get his error :
The operation failed because:
Active Directory could not replicate the directory...
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
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...
|
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...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
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...
| |