OberonPlace.com Forums  

Go Back   OberonPlace.com Forums > Developer Forums > VBA > CorelDRAW/Corel DESIGNER VBA

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 01-07-2006, 22:08
knowbodynow knowbodynow is offline
Senior Member
 
Join Date: Mar 2006
Location: Hatsukaichi near Hiroshima
Posts: 434
Default Calling One Sub from another?

Hello,

I have the following code:

Code:
Sub schwa()
Dim P As Page, 
Dim sh As Shape
    
For Each P In ActiveDocument.Pages
P.Activate
For Each sh In ActivePage.ActiveLayer.FindShapes(Type:=cdrTextShape)
      
If sh.Text.Story = "zebra" Then
sh.Text.Range(4, 5).Fill.UniformColor.CMYKAssign 0, 20, 20, 50
End If
     
Next sh
Next P

End Sub
I tried to move the text story part to another sub called schwaword and call it like this:

Code:
Sub schwa()
Dim P As Page, 
Dim sh As Shape
    
For Each P In ActiveDocument.Pages
P.Activate
For Each sh In ActivePage.ActiveLayer.FindShapes(Type:=cdrTextShape)
      
schwaword
     
Next sh
Next P

end sub

------------------------

sub schwaword()
    
If sh.Text.Story = "zebra" Then
sh.Text.Range(4, 5).Fill.UniformColor.CMYKAssign 0, 20, 20, 50
End If

End Sub
But this didn't work. I know the sub is being called (I tried putting a message box in it) but it is not processing the words in my CorelDraw document.

What am I doing wrong?

Thanks,

Chris (Hunt)
Reply With Quote
  #2  
Old 01-07-2006, 22:26
shelbym's Avatar
shelbym shelbym is offline
Senior Member
 
Join Date: Nov 2002
Location: Cheyenne, WY
Posts: 1,778
Blog Entries: 11
Send a message via ICQ to shelbym Send a message via AIM to shelbym Send a message via MSN to shelbym Send a message via Yahoo to shelbym
Default Calling Subs

You have to pass the shape like this, also you would normally make the second sub private so it doesn't show up in your play list.

Code:
Sub schwa()

Dim P As Page
Dim sh As Shape
    
For Each P In ActiveDocument.Pages
    P.Activate
    For Each sh In ActivePage.ActiveLayer.FindShapes(Type:=cdrTextShape)
        schwaword sh
    Next sh
Next P

End Sub

Private Sub schwaword(sh As Shape)
    
If sh.Text.Story = "zebra" Then
    sh.Text.Range(4, 5).Fill.UniformColor.CMYKAssign 0, 20, 20, 50
End If

End Sub
Hope it helps,

Shelby

Last edited by shelbym; 01-07-2006 at 22:34.
Reply With Quote
  #3  
Old 01-07-2006, 23:49
knowbodynow knowbodynow is offline
Senior Member
 
Join Date: Mar 2006
Location: Hatsukaichi near Hiroshima
Posts: 434
Default

Thanks, Shelby,

That helps brilliantly. This is going to really help me streamline my macros!

Best wishes,

Chris
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
Calling Macro from GlobalMacro shelbym Code Critique 1 27-01-2005 19:05
calling .exe bumblebee CorelDRAW/Corel DESIGNER VBA 2 02-12-2004 19:21
error while calling CorelScript.EditRestoreCheckpoint rsinnig Corel Photo-Paint VBA 1 01-11-2003 05:14


All times are GMT -5. The time now is 20:10.


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