OberonPlace.com Forums  

Go Back   OberonPlace.com Forums > Developer Forums > VBA > CorelDRAW/Corel DESIGNER VBA

Thread Tools Search this Thread Display Modes
Old 19-10-2011, 02:07
noj noj is offline
Join Date: Oct 2011
Location: Sydney
Posts: 31
Default Do...loop error

Can anyone tell me why I'm getting the Runtime Error '91' "Object variable or With block variable not set" which comes up right at the end of running this code? The line in blue is the issue.

Sub Random()
Dim bulbs As ShapeRange
Set bulbs = ActiveSelectionRange
Dim Num As Integer
Num = 1
Counter = 1
Do Until Counter = bulbs.Count
With bulbs(Num).Fill
.ApplyUniformFill CreateRGBColor(255, 0, 0)
Num = Num + Int((3 * Rnd) + 2)
Counter = Counter + 1
End With
End Sub

Last edited by noj; 19-10-2011 at 02:10.
Reply With Quote
Old 19-10-2011, 02:26
noj noj is offline
Join Date: Oct 2011
Location: Sydney
Posts: 31

Never mind. I fixed it with an If Then statement. I think the code was referencing a shape that didn't exist at the end.
Reply With Quote
Old 19-10-2011, 10:25
runflacruiser's Avatar
runflacruiser runflacruiser is offline
Senior Member
Join Date: Jun 2009
Location: Pigeon Forge, TN USA
Posts: 811

Yea... Looks like nothing was selected so the shaperange index wasn't set to a shape.
Reply With Quote

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Can't loop thru layers xxxslowjoe CorelDRAW/Corel DESIGNER VBA 1 06-06-2009 13:52
Simple Loop? dan CorelDRAW/Corel DESIGNER VBA 3 13-10-2004 14:31

All times are GMT -5. The time now is 12:24.

Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2023, Jelsoft Enterprises Ltd.
Copyright © 2011, Oberonplace.com