Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 80
Default ActiveX ProgressBar - Scrolling Error disables color update

I am placing activex progress bars (PB) in a range of cells setting the
colors of the PB based on content of other cells. At first, my problem was
when one (or more) cells height are large I would get this error "'Run-time
'-2147467259 (80004005)'; Method 'Scrolling' of object 'IprogressBar'
failed". MS said this error was do to a refresh rate issue and to trap the
error with a resume. This will wait until the screen is refreshed. This
solution stops the 'run-time error' message, but I can't change the color of
the problem PB. Here's my code that Adds the Progress Bar with the Error
Handler.
The problem seems to be a function of the size of the range (number of
cells) and the number of cells at larger heights.

Public Sub AddProgressBar(rCell As Range)
Dim OLEObj As OLEObject

With rCell
Set OLEObj = .Parent.OLEObjects.Add _
(ClassType:="MSComctlLib.ProgCtrl.2", _
Left:=.Left, Top:=.Top, _
Width:=.Width + 1, Height:=.Height + 1)
End With

Call setBarColors("white") sets the BarColors type used below
'On Error GoTo Err_Progress
With OLEObj
.Placement = xlMoveAndSize
.Visible = True
With .Object
Call SetProgressBackColor(.hwnd, RGB(BarColors.Red, BarColors.Green,
BarColors.Blue))
.Min = 0
.Max = 1
.Value = 0
.Appearance = ccFlat
.BorderStyle = ccFixedSingle
.MousePointer = ccDefault
.OLEDropMode = ccOLEDropNone
.Orientation = ccOrientationHorizontal
.Scrolling = ccScrollingSmooth
End With
End With
On Error GoTo 0

Exit Sub

Err_Progress:
Debug.Print "AddProgressBar", Err.Number
If Err.Number = -2147467259 Then
Resume 'until control is visible.
Else
MsgBox "Error displaying Progress Bar", vbCritical + vbOKOnly
Err = 0
On Error GoTo 0
End If
End Sub

Any inputs/suggestions appreciated.
- Pat
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default ActiveX ProgressBar - Scrolling Error disables color update

I can't replicate your first problem but I expect the reason you appear not
to be able to change the colour is because you are changing Scrolling after
applying your custom colour (SendMessage I assume). So apply your colour
after changing all the PB properties.

Regards,
Peter T


"Dreiding" wrote in message
...
I am placing activex progress bars (PB) in a range of cells setting the
colors of the PB based on content of other cells. At first, my problem
was
when one (or more) cells height are large I would get this error
"'Run-time
'-2147467259 (80004005)'; Method 'Scrolling' of object 'IprogressBar'
failed". MS said this error was do to a refresh rate issue and to trap
the
error with a resume. This will wait until the screen is refreshed. This
solution stops the 'run-time error' message, but I can't change the color
of
the problem PB. Here's my code that Adds the Progress Bar with the Error
Handler.
The problem seems to be a function of the size of the range (number of
cells) and the number of cells at larger heights.

Public Sub AddProgressBar(rCell As Range)
Dim OLEObj As OLEObject

With rCell
Set OLEObj = .Parent.OLEObjects.Add _
(ClassType:="MSComctlLib.ProgCtrl.2", _
Left:=.Left, Top:=.Top, _
Width:=.Width + 1, Height:=.Height + 1)
End With

Call setBarColors("white") sets the BarColors type used below
'On Error GoTo Err_Progress
With OLEObj
.Placement = xlMoveAndSize
.Visible = True
With .Object
Call SetProgressBackColor(.hwnd, RGB(BarColors.Red, BarColors.Green,
BarColors.Blue))
.Min = 0
.Max = 1
.Value = 0
.Appearance = ccFlat
.BorderStyle = ccFixedSingle
.MousePointer = ccDefault
.OLEDropMode = ccOLEDropNone
.Orientation = ccOrientationHorizontal
.Scrolling = ccScrollingSmooth
End With
End With
On Error GoTo 0

Exit Sub

Err_Progress:
Debug.Print "AddProgressBar", Err.Number
If Err.Number = -2147467259 Then
Resume 'until control is visible.
Else
MsgBox "Error displaying Progress Bar", vbCritical + vbOKOnly
Err = 0
On Error GoTo 0
End If
End Sub

Any inputs/suggestions appreciated.
- Pat



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
repost: clickable graphs (hyperlinked) used to update source data? maybe an activeX? KR Excel Programming 0 June 20th 06 06:07 PM
How do I update contents of activeX combobox? Paul Silverman Excel Programming 1 September 20th 04 01:54 PM
Scrolling gives me error 424 Abhi[_3_] Excel Programming 0 April 6th 04 08:48 AM
Error 50290: Error writing to Worksheet while using an ActiveX Control emblair3 Excel Programming 3 February 24th 04 06:03 PM
Input Box error when scrolling jurgenC![_2_] Excel Programming 3 January 16th 04 10:36 PM


All times are GMT +1. The time now is 07:50 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"