OberonPlace.com Forums  

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

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 06-12-2013, 20:42
knowbodynow knowbodynow is offline
Senior Member
 
Join Date: Mar 2006
Location: Hatsukaichi near Hiroshima
Posts: 434
Default Form hanging X6 on initialize

I have a user form that has a listbox (with checkboxes) of layers on the page. The following code works while initializing:

Code:
    For i = 0 To ListToExp.ListCount - 1
            nam = ListToExp.list(i)
            MsgBox nam
    Next i
But this code hangs Draw:

Code:
    For i = 0 To ListToExp.ListCount - 1
            nam = ListToExp.list(i)
            If ActivePage.AllLayers(nam).Visible = True Then ListToExp.Selected(i) = True
    Next i
How can I get the form to appear with visible layers on the page checked? Thanks
Reply With Quote
  #2  
Old 06-12-2013, 23:18
knowbodynow knowbodynow is offline
Senior Member
 
Join Date: Mar 2006
Location: Hatsukaichi near Hiroshima
Posts: 434
Default

I've found the problem. I also have an Change event on the listbox:

Code:
Private Sub ListToExp_Change()

    Dim Activate As Boolean

    Activate = False

    For i = 0 To ListToExp.ListCount - 1
    If ListToExp.Selected(i) = True Then
        Activate = True
        Exit For
    End If
    Next i

    If Activate = True Then
    cmdOK.Enabled = True
    Else
    cmdOK.Enabled = False
    End If

End Sub
I only want the cmdOK button to be enabled if at least one item in the listbox is checked. So how to initialise the selection as in the previous post and still be able to check the status of the listbox? Running two loops seems to be a no-no.
Reply With Quote
  #3  
Old 12-12-2013, 08:49
ddonnahoe's Avatar
ddonnahoe ddonnahoe is offline
Senior Member
 
Join Date: Jan 2004
Location: Louisville, KY
Posts: 552
Send a message via ICQ to ddonnahoe Send a message via AIM to ddonnahoe Send a message via MSN to ddonnahoe Send a message via Yahoo to ddonnahoe
Default

Not sure if I'm talking out of my rear, but is it possible to use "While..." for what you are trying to do?
__________________
Sean
Waiting for a ride in the T.A.R.D.I.S.
Reply With Quote
Reply


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
Open form from another form Adrian_Juman CorelDRAW/Corel DESIGNER VBA 1 08-04-2011 21:56
Autostart a form? burmeisn CorelDRAW/Corel DESIGNER VBA 4 20-07-2010 01:23
Problem with Corel VBA Hanging knowbodynow CorelDRAW/Corel DESIGNER VBA 6 09-07-2010 13:06
calling another form with a button in a form gorgo CorelDRAW/Corel DESIGNER VBA 1 27-05-2010 08:23
string in form runflacruiser CorelDRAW/Corel DESIGNER VBA 1 23-09-2009 01:31


All times are GMT -5. The time now is 17:20.


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