Full code
'Dim bm As Bitmap
Dim x As Long, y As Long
Dim kolor As Color
x = 0
y = 0
Dim whitePix As Boolean
whitePix= False
'For x = 0 To sh.Bitmap.Image.Height - 1
Do While x < sh.Bitmap.Image.Height - 1
'For y = 0 To sh.Bitmap.Image.Width - 1
Do While y < sh.Bitmap.Image.Width - 1
Set kolor = sh.Bitmap.Image.Pixel(x, y)
'kolor = kolor.ConvertToCMYK
With kolor
If .Type = cdrColorCMYK Then
If kolor.CMYKBlack = 0 And .CMYKCyan = 0 And .CMYKMagenta = 0 And .CMYKYellow = 0 Then
whitePix = True
End If
ElseIf .Type = cdrColorRGB Then
If .RGBRed > 253 And .RGBGreen > 253 And .RGBBlue > 253 Then
whitePix = True
End If
End If
End With
'Next y
y = y + 1
Loop
'Next x
x = x + 1
Loop
sh = shape
Which line throws that error? I
The problem is caused by the line that declares the loop limit. Of course, it depends on the size of the image (larger than 300 x 300 pixels).