OberonPlace.com Forums  

Go Back   OberonPlace.com Forums > Corel User Forums > CorelDRAW > General

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 09-07-2012, 07:11
marshal marshal is offline
Junior Member
 
Join Date: Jul 2012
Posts: 1
Default NOOB Question

OK, VERY new to VB and macros. After learning a lot from deconstructing and reconstructing the ColorReplacer macro (TY) which I'm using for the basic of my macro.

Here's what I have so far that works:

Private Sub cbPod1_Click()
If cbPod1.Value = False Then
cbPod1.BackColor = &H8000000F
cmFind1.BackColor = &H8000000F
lblFind1.Caption = "Color"
lblHeight1.Caption = "Height"
lblWidth1.Caption = "Width"
Else
cbPod1.BackColor = RGB(0, 255, 0)
If cfg.sWidth1 = 0 Then
cfg.PodNum = 1
GetStoneInfo
Else
UpdateColor cfg.clrFind1, cmFind1, lblFind1, lblHeight1, lblWidth1, cfg.sHeight1, cfg.sWidth1
End If
End If
End Sub
Private Sub cbPod2_Click()
If cbPod2.Value = False Then
cbPod2.BackColor = &H8000000F
cmFind2.BackColor = &H8000000F
lblFind2.Caption = "Color"
lblHeight2.Caption = "Height"
lblWidth2.Caption = "Width"
Else
cbPod2.BackColor = RGB(0, 255, 0)
If cfg.sWidth2 = 0 Then
cfg.PodNum = 2
GetStoneInfo
Else
UpdateColor cfg.clrFind2, cmFind2, lblFind2, lblHeight2, lblWidth2, cfg.sHeight2, cfg.sWidth2
End If
End If
End Sub
Private Sub cbPod3_Click()
If cbPod3.Value = False Then
cbPod3.BackColor = &H8000000F
cmFind3.BackColor = &H8000000F
lblFind3.Caption = "Color"
lblHeight3.Caption = "Height"
lblWidth3.Caption = "Width"
Else
cbPod3.BackColor = RGB(0, 255, 0)
If cfg.sWidth3 = 0 Then
cfg.PodNum = 3
GetStoneInfo
Else
UpdateColor cfg.clrFind3, cmFind3, lblFind3, lblHeight3, lblWidth3, cfg.sHeight3, cfg.sWidth3
End If
End If
End Sub
Private Sub cbPod4_Click()
If cbPod4.Value = False Then
cbPod4.BackColor = &H8000000F
cmFind4.BackColor = &H8000000F
lblFind4.Caption = "Color"
lblHeight4.Caption = "Height"
lblWidth4.Caption = "Width"
Else
cbPod4.BackColor = RGB(0, 255, 0)
If cfg.sWidth4 = 0 Then
cfg.PodNum = 4
GetStoneInfo
Else
UpdateColor cfg.clrFind4, cmFind4, lblFind4, lblHeight4, lblWidth4, cfg.sHeight4, cfg.sWidth4
End If
End If
End Sub
Private Sub cbPod5_Click()
If cbPod5.Value = False Then
cbPod5.BackColor = &H8000000F
cmFind5.BackColor = &H8000000F
lblFind5.Caption = "Color"
lblHeight5.Caption = "Height"
lblWidth5.Caption = "Width"
Else
cbPod5.BackColor = RGB(0, 255, 0)
If cfg.sWidth5 = 0 Then
cfg.PodNum = 5
GetStoneInfo
Else
UpdateColor cfg.clrFind5, cmFind5, lblFind5, lblHeight5, lblWidth5, cfg.sHeight5, cfg.sWidth5
End If
End If
End Sub
Private Sub cbPod6_Click()
If cbPod6.Value = False Then
cbPod6.BackColor = &H8000000F
cmFind6.BackColor = &H8000000F
lblFind6.Caption = "Color"
lblHeight6.Caption = "Height"
lblWidth6.Caption = "Width"
Else
cbPod6.BackColor = RGB(0, 255, 0)
If cfg.sWidth6 = 0 Then
cfg.PodNum = 6
GetStoneInfo
Else
UpdateColor cfg.clrFind6, cmFind6, lblFind6, lblHeight6, lblWidth6, cfg.sHeight6, cfg.sWidth6
End If
End If
End Sub

Basically, all do the same thing. The only thing thing that changes is the pod number. I'm sure there is a better way to code this. Any help is appreciated.

Thinking something would be something like the below but again very new to coding.

Private Sub cbPod1 ()
cbPod(1)
End Sub
Private Sub cbPod2 ()
cbPod(2)
End Sub
etc.....

Private Sub cbPod(Pod As Integer)
If cbPod(Pod) = False Then
cbPod(Pod).BackColor = &H8000000F
cmFind(Pod).BackColor = &H8000000F
lblFind(Pod).Caption = "Color"
lblHeight(Pod).Caption = "Height"
lblWidth(Pod).Caption = "Width"
Else
cbPod(Pod).BackColor = RGB(0, 255, 0)
If cfg.sWidth(Pod) = 0 Then
GetStoneInfo
Else
UpdateColor cfg.clrFind(Pod), cmFind(Pod), lblFind(Pod), lblHeight(Pod), lblWidth(Pod), cfg.sHeight(Pod), cfg.sWidth(Pod)
End If
End If
End Sub
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
For...Each...Next question noj CorelDRAW/Corel DESIGNER VBA 4 21-10-2011 09:02
ETC Question!!!! [Please~~~~~] ljesus7 CorelDRAW/Corel DESIGNER VBA 2 08-03-2007 06:45
Icon Question dungbtl CorelDRAW/Corel DESIGNER VBA 0 17-03-2005 17:37
question sejal01 CorelDRAW/Corel DESIGNER VBA 1 22-12-2004 21:27
vba question bumblebee CorelDRAW/Corel DESIGNER VBA 4 04-08-2004 15:07


All times are GMT -5. The time now is 05:03.


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