Private Sub UserForm_Initialize()
'populate listboxes for each page
h = 0
For Each l In ActivePage.AllLayers
If l.name <> "Grid" And l.name <> "Guides" And l.name <> "Desktop" And l.name <> "Document Grid" And l.name <> "TEMP" Then
frmSetLayers.ListOn.AddItem l.name
frmSetLayers.ListOff.AddItem l.name
h = h + 15
End If
Next l
MsgBox h
frmSetLayers.ListOn.Height = h
frmSetLayers.ListOff.Height = h
h = h + 25
frmSetLayers.cmdOK.Top = h
h = h + 60
frmSetLayers.Height = h
End Sub
This code creates two listboxes (ListOn and ListOff) populated with the layer names taken from the the active CorelDraw Page. The msgbox shows the height each listbox will be resized to. With the msgbox the form displays correctly but without it I'm getting weird issues. One or both of the listboxes (usually ListOn) fails to resize and instead shows scrollbars. I think it might be a graphics card issue. Has anyone else seen this kind of problem? What can I do to resolve it? Thanks.
Private Sub UserForm_Initialize()
'populate listboxes for each page
h = 0
For Each l In ActivePage.AllLayers
Select Case l.Name
Case "Grid", "Guides", "Desktop", "Document Grid", "TEMP"
' Skip these
Case Else
Me.ListOn.AddItem l.Name
Me.ListOff.AddItem l.Name
h = h + 15
End Select
Next l
MsgBox h
Me.ListOn.Height = h
Me.ListOff.Height = h
h = h + 25
Me.cmdOK.Top = h
h = h + 60
Me.Height = h
End Sub
The code works OK for me in Word or Excel (after modifying it slightly for those applications of course), and I don't think the graphics card could cause this. Does it help if you insert a line
Thanks, I should have mentioned that I tried Me.repaint. It didn't help. The only thing that does help is inserting the msgbox. I tired pausing the script at that point but that made no difference either. Perhaps it is a CorelDraw vba bug. If I have one listbox rather than two then I also don't have a problem.