Riku
Programmer
- Sep 2, 2001
- 119
I thought maybe "Corel Draw" section is not necessary right place to put this question as this has more to do with VBA. Therefore I ask my question here also.
I possibly found a bug in Corel Draw VBA engine?
A. When using CreateSelection in a loop the selection is only activated at first loop event even though loop goes trough several times.
B. If putting a TOGGLE POINT AT SERTAIN ROW marked below the CreateSelection is getting activated each loop.
Dim p_index As Integer
Dim theShapeRange As ShapeRange
Dim x As Double, y As Double
For p_index = 0 To ActiveDocument.Pages.Count - 1
Dim thePage As Page
Set thePage = ActiveDocument.Pages(p_index + 1)
thePage.Activate
Set theShapeRange = ActivePage.Shapes.All
theShapeRange.CreateSelection
ActivePage.Layers("Layer 1").Activate 'Toggle point here
ActiveSelection.GetSize x, y
Debug.Print ActiveDocument.ActivePage.Name & "|" & x
Next
Example on result
I have 5 pages and different drawing on all pages.
Output:
A.
Without TOGGLE POINT
page 1 | 3,34
page 2 | 3,34
page 3 | 3,34
page 4 | 3,34
page 5 | 3,34
B.
Using TOGGLE POINT
page 1 | 3,34
page 2 | 60,333
page 3 | 23,32
page 4 | 31,3
page 5 | 32,34
Any Ideas how tofix thesituation?
F: Riku Tuominen
riku.tuominen@benchmarking.fi
I possibly found a bug in Corel Draw VBA engine?
A. When using CreateSelection in a loop the selection is only activated at first loop event even though loop goes trough several times.
B. If putting a TOGGLE POINT AT SERTAIN ROW marked below the CreateSelection is getting activated each loop.
Dim p_index As Integer
Dim theShapeRange As ShapeRange
Dim x As Double, y As Double
For p_index = 0 To ActiveDocument.Pages.Count - 1
Dim thePage As Page
Set thePage = ActiveDocument.Pages(p_index + 1)
thePage.Activate
Set theShapeRange = ActivePage.Shapes.All
theShapeRange.CreateSelection
ActivePage.Layers("Layer 1").Activate 'Toggle point here
ActiveSelection.GetSize x, y
Debug.Print ActiveDocument.ActivePage.Name & "|" & x
Next
Example on result
I have 5 pages and different drawing on all pages.
Output:
A.
Without TOGGLE POINT
page 1 | 3,34
page 2 | 3,34
page 3 | 3,34
page 4 | 3,34
page 5 | 3,34
B.
Using TOGGLE POINT
page 1 | 3,34
page 2 | 60,333
page 3 | 23,32
page 4 | 31,3
page 5 | 32,34
Any Ideas how tofix thesituation?
F: Riku Tuominen
riku.tuominen@benchmarking.fi