(I had to repost this in here, maybe its the right place)
Hello everyone.
In CDRx16 i have this template that changes the Document.WorldScale when i change the page.To achieve this, i used VBA inside the Document VBAProject.ThisDocument with this code.
Private Sub Document_PageActivate(ByVal Page As Page)ActiveDocument.WorldScale = 0 & ActivePage.Layers("Work").Shapes("Scale").Text.StoryEnd Sub
In the Document Template i have one layer named "Work", with one Paragraph Text Shape named "Scale" that i use to change the WorldScale, for example:Page 1: Text Shape "Scale" with value 50 - When I change to this page, the WorldScale is set to 1/50Page 2: Text Shape "Scale" with value 30 - When I change to this page, the WorldScale is set to 1/30Page 3: Text Shape "Scale" with value 100 - When I change to this page, the WorldScale is set to 1/100
Now, this works well in CorelDRAW x16, on the new CorelDRAW 2017 it does't work. Corel ignores the code.
The worst part is that CRASH's CorelDRAW, making the Documents worthless, because they won't open.
Any one has some idea on how to achieve this in the version of CorelDRAW?
If anyone can test this would be great. Create a blank Document, add 3 pages and place the code below in the VBAProject.ThisDocument to test it out, if it fires the code.
Private Sub Document_PageActivate(ByVal Page As Page)MsgBox "Page number: " & ActivePage.IndexEnd Sub
Thank you all very much.
Rob.
Try this:
Sub Test()Dim Ch1 As String, lg1 As LongCh1 = ActivePage.Layers("Work").Shapes("Scale").Text.Storylg1 = Val(Ch1)If lg1 > 0 Then ActiveDocument.WorldScale = lg1MsgBox ActiveDocument.WorldScaleEnd Sub
The crash - does it happen before or after you activated the macros? Maybe this already saved code causes the crash. Do you have to confirm the macros when opening a document? If not change it under Tools / Options / Workspace / VBA