473,383 Members | 1,859 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,383 software developers and data experts.

Validation not working: run-time error '-2147417848 (80010108)'

11
I'm trying to get certain cells to show a hovering alert message when I click on them. (I don't want an error-message style box to pop up, because I'll eventually want it to show for lots of cells at once.)

I recorded a macro to get the code, which I tweaked minimally, and pasted into a clean spreadsheet to test it. It seems to work beautifully. However, when I try to apply the same code within a larger programme, in a working spreadsheet, I get the following error-message:
Run-time error '-2147417848 (80010108)':
Automation error
The object invoked has disonnected from its clients.
(If I click "debug", then Line 15 in Code Sample 2 below is highlighted)



Code Sample 1 - the version that works

Expand|Select|Wrap|Line Numbers
  1. Sub ValidationTesting()
  2.  
  3. Dim Row As Long
  4. Row = 10
  5.  
  6.             With Worksheets(1).Cells(Row, 6).Validation
  7.                     .Delete
  8.                     .Add Type:=xlValidateInputOnly, AlertStyle:=xlValidAlertStop, Operator:=xlBetween
  9.                     .IgnoreBlank = True
  10.                     .InCellDropdown = True
  11.                     .InputTitle = "Low Calcium Concentration!"
  12.                     .ErrorTitle = ""
  13.                     .InputMessage = "Ca concentration was too low for the calculation.  It has been adjusted to the minimum value allowed."
  14.                     .ErrorMessage = ""
  15.                     .ShowInput = True
  16.                     .ShowError = True
  17.             End With
  18.  
  19. End Sub
  20.  
Code Sample 2 - the version that doesn't work

Expand|Select|Wrap|Line Numbers
  1. Private Sub CaAdjustmentButton_Click()
  2.  
  3. Dim TotalRows As Long
  4. TotalRows = Worksheets("Calculation").UsedRange.Rows.Count
  5. Dim Row As Long
  6.  
  7. For Row = 10 To TotalRows Step 1
  8.  
  9.         If Worksheets("Calculation").Cells(Row, 5) < 5 Then
  10.                 Worksheets("Calculation").Cells(Row, 6).Interior.ColorIndex = 3 'red
  11.                 Worksheets("Calculation").Cells(Row, 6).Font.ColorIndex = 2 'white
  12.                 Worksheets("Calculation").Cells(Row, 6).Value = "5"
  13.                 With Worksheets("Calculation").Cells(Row, 6).Validation
  14.                     .Delete
  15.                     .Add Type:=xlValidateInputOnly, AlertStyle:=xlValidAlertStop, Operator:=xlBetween
  16.                     .IgnoreBlank = True
  17.                     .InCellDropdown = True
  18.                     .InputTitle = "Low Calcium Concentration!"
  19.                     .ErrorTitle = ""
  20.                     .InputMessage = "Ca concentration was too low for the calculation.  It has been adjusted to the minimum value allowed."
  21.                     .ErrorMessage = ""
  22.                     .ShowInput = True
  23.                     .ShowError = True
  24.                 End With
  25.  
  26.             ElseIf Worksheets("Calculation").Cells(Row, 5).Value > 150 Then
  27.                 'Call CaAboveMaximum(Row)
  28.                 Worksheets("Calculation").Cells(Row, 6).Interior.ColorIndex = 5 'blue
  29.                 Worksheets("Calculation").Cells(Row, 6).Font.ColorIndex = 2 'white
  30.                 Worksheets("Calculation").Cells(Row, 6).Value = "150"
  31.             Else:
  32.                 'CaWithinRange (Row)
  33.                 Worksheets("Calculation").Cells(Row, 6).Interior.ColorIndex = 35 'pale green
  34.                 Worksheets("Calculation").Cells(Row, 6).Font.ColorIndex = 1 'black
  35.                 Worksheets("Calculation").Cells(Row, 6).Value = Worksheets("Calculation").Cells(Row, 5).Value
  36.         End If
  37.  
  38. Next Row
  39.  
  40. Call InactivateButton
  41.  
  42. MsgBox ("Red or Blue cells indiate input values for Calcium outside allowable range.  Select individual cells for details.")
  43.  
  44. End Sub
  45.  
  46.  
Jan 24 '08 #1
6 11421
Lara1
11
Okay, following a bit more investigation - the problem ONLY happens when i try to run code sample 2 (see previous post, above) from a button. If I run it from a SheetChange event, or just by itself, it works perfectly.
Jan 25 '08 #2
Killer42
8,435 Expert 8TB
Try http://support.microsoft.com/kb/319832
Jan 29 '08 #3
Lara1
11
I already saw that article, before I posted. Trouble was, I couldn't understand any of it :-(

A colleague of a friend has said he thinks the problem is to do with the use of validations, which are complicated (and use external code?). So now i'm trying to figure out how to use shapes with text in, instead of input messages.
Feb 15 '08 #4
kadghar
1,295 Expert 1GB
I already saw that article, before I posted. Trouble was, I couldn't understand any of it :-(

A colleague of a friend has said he thinks the problem is to do with the use of validations, which are complicated (and use external code?). So now i'm trying to figure out how to use shapes with text in, instead of input messages.
First of all, are you running your code from VBA in Excel, or from any other VB.
This error happens when you have a variable not defined, so it could be that you're outside Excel's VBA and it doesn't recognize the XL constants.
Feb 15 '08 #5
Lara1
11
First of all, are you running your code from VBA in Excel, or from any other VB.
This error happens when you have a variable not defined, so it could be that you're outside Excel's VBA and it doesn't recognize the XL constants.
hi kadghar - i'm running the code within excel.

to save you putting a lot of time into fixing this, though - i've decided to use AddComment instead, it's working fine and seems to do the job. However, if you have any insight into the problem and want to share it, then please feel free - it's all good learning, for me.
Feb 15 '08 #6
Hello,

I had the same problem (Run-time error '-2147417848 (80010108)') when I was working in VBA Excel with validation checks.

I solved this selecting the cell where the validation is (range.select) before applying the "validation.add". With this correction, the macro works fine.

In your example, I suppose you will need that:


.....
.....
Worksheets("Calculation").Cells(Row, 6).Value = "5"
Worksheets("Calculation").Cells(Row, 6).Select
With Worksheets("Calculation").Cells(Row, 6).Validation
.....
.....



Regards
Feb 1 '10 #7

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

Similar topics

5
by: Bob Bamberg | last post by:
Hello All, I have been trying without luck to get some information on debugging the Runtime Error R6025 - Pure Virtual Function Call. I am working in C++ and have only one class that is derived...
6
by: Dan Roberts | last post by:
I am running some off-the-shelf software that is written in ASP, which uses JScript to generate dynamic content within HTML forms. There are several ASP pages which are partially rendering to IE,...
0
by: Jamey | last post by:
I perused old posts for an answer to this for at least an hour, and I've found a work-around, but no definitive answer. Synopsis of the problem: On NotInList or ctl.Requery commands where a...
7
by: yuanlinjiang | last post by:
I am working on converting a win32 console application from VC6 to VC7. My version is Microsoft Development Environment 2003 version 7.1.3088. The code works fine on VC6. it is a console...
2
by: Brian Graham | last post by:
A user is trying to find a particular record. If she does a Ctrl-F, the second time the Find is invoked, the above runtime error occurs. Subsequent Finds are not generally a problem, though on rare...
0
by: =?Utf-8?B?UkJlbGw=?= | last post by:
I have a VB .NET app that I've been working on for quite some time. The app has been working fine with no problems. I have recently been charged with Internationalizing the app. Since I have never...
2
by: =?Utf-8?B?TUNN?= | last post by:
I have an UpdatePanel that is throwing the following error on an attempted postback: Sys.WebForms.PagerequestManagerServerErrorException: An Unknown error occurred while processing the request...
3
by: nitewriter | last post by:
Hi, Can someone help me with this scripts, it works on a different server but gives me error now, This is the error I now get Microsoft VBScript runtime error '800a01f4' Variable is...
16
by: rudivs | last post by:
I would like to do data validation in the BeforeUpdate procedure, but Access gives me a runtime error when I try to do this: An example of what I am trying to do is as follows: Private Sub...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
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$) { } ...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
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...
0
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 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.