Hi,
I'm trying to modify a Corel Drawing programatically using VB.net rather than VBA. I don't seem to be able to do simple things such as FindShape. I've added the CorelDRAW reference library but to no avail... Here's an example of what I want to do:
Dim S as ShapeDim TextToInsert As String
TextToInsert = “New Text”
Set S = ActiveLayer.Shapes.FindShape("SignatureEnglish") ‘should finds your objects named SignatureEnglish – this is case sensitive
If S Is Nothing Then GoTo Ending: ‘if it doesn’t find the shape, go to endEnd if
If Not S Is Nothing And S.Type = cdrTextShape Then ‘if S is anything AND it’s a cdrTextShape object…S.Text.Story = TextToInsert ‘inserts the text in your string variable…
End If
Ending:
Can someone help with this please? Or tell me what's going on in VB.net vs. VBA?
Thanks!
Vibeke
Dim s As Shape
For Each s In ActivePage.ShapesIf s.Name = "signatureenglish" Thens.Name = "foundit"End IfIf s.Type = cdrTextShape Thens.Text.Story = "New Text"End IfNext s
Thank you Michael for your response. I'm still not able to make it work though.
The first line I've changed to: Dim s As CorelDRAW.Shape
The second line "ActivePage" is underlined with the following comment: "Name 'ActivePage' is not declared". I seem to be stuck here. I'm new to this so bear with me please :-).
Thanks Again
Try to declare a Shell at first like a "Sub-" or a "Function-"Command, for example:
Sub YourDesiredSubName()
Dim s As ShapeFor Each s In ActivePage.ShapesIf s.Name = "signatureenglish" Thens.Name = "foundit"End IfIf s.Type = cdrTextShape Thens.Text.Story = "New Text"End IfNext s
End Sub
I still have the same problem... "Name 'ActivePage' is not declared". Help?
Dim s As CorelDRAW.Shape
For Each s In CorelDRAW.ActivePage.ShapesIf s.Name = "signatureenglish" Thens.Name = "foundit"End IfIf s.Type = cdrTextShape Thens.Text.Story = "New Text"End IfNext s