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 14-05-2005, 08:53
beny04
Guest
 
Posts: n/a
Question insert a character by vba

to insert a character isn't difficult (Ctrl+F11....). But I have diffucults to record a macro, who can give back the character alfa i.e.
Who knows the solution?
beny04
Reply With Quote
  #2  
Old 14-05-2005, 09:12
petig
Guest
 
Posts: n/a
Default

It should be CorelDRAW 11. Don't record a lot of... Try 12, in that the VBA works better.
Reply With Quote
  #3  
Old 14-05-2005, 10:30
petig
Guest
 
Posts: n/a
Default

To insert any character from VBA may use the Chr(x) vb function. It use the charactercode from actual codepage (x = 32 to 255). There is another function, ChrW(x), where x is the unicode index of the character, but it looks don't work in CDr11. But, maybe, I made some mistake...

Sample to insert character:
Code:
ActiveShape.Text.Selection.InsertAfter Chr(245)
' 245 otilde on 1252 codepage and in unicode
' ohungarumlaut on 1250 codepage
But, first you shold be sure the textcursor is in text.
Reply With Quote
  #4  
Old 14-05-2005, 10:47
petig
Guest
 
Posts: n/a
Default

Hey beny04! It maybe helps more like me: Text ENCODE
Reply With Quote
  #5  
Old 15-05-2005, 08:21
beny04
Guest
 
Posts: n/a
Red face insert a character

Hello,
thanks for your answers! The first steps are successfull!

Sub alfa()
ActiveShape.Text.Selection.InsertAfter Chr(97), Font:="Symbol"
End Sub

Now I try to program the Font size, and the superscript or the subscript mode.
Where I can find a introduction to make VBA-code in coreldraw?

Thanks and kind regard!
beny04
Reply With Quote
  #6  
Old 15-05-2005, 16:27
shelbym's Avatar
shelbym shelbym is offline
Senior Member
 
Join Date: Nov 2002
Location: Cheyenne, WY
Posts: 1,791
Blog Entries: 15
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 VBA Programming Guide

CorelDraw 12 comes with a VBA programing guide. By default the user guides are not installed so you will need to install them. The file is called: dvba_pg.pdf also there is a PDF for the CorelDraw 12 Object Model called: VBA Object Model.pdf

Hope it Helps.

Shelby
Reply With Quote
  #7  
Old 15-05-2005, 16:33
shelbym's Avatar
shelbym shelbym is offline
Senior Member
 
Join Date: Nov 2002
Location: Cheyenne, WY
Posts: 1,791
Blog Entries: 15
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 Superscript

The following example creates a text object with a subscript character.

Code:
Sub Test()

 Dim s As Shape
 Set s = ActiveLayer.CreateArtisticText(4, 5, "H2O")
 s.Text.FontPropertiesInRange(2, 1).Position = cdrSubscriptFontPosition

End Sub
Hope it helps,

Shelby
Reply With Quote
  #8  
Old 15-05-2005, 17:11
Alex's Avatar
Alex Alex is offline
Administrator
 
Join Date: Nov 2002
Posts: 1,941
Blog Entries: 4
Default

Quote:
s.Text.FontPropertiesInRange(2, 1).Position = cdrSubscriptFontPosition
This is actually a bad example. You shouldn't use FontPropertiesInRange. Instead, you should use Text.Story and proper text range:

Code:
Sub Test()
    Dim s As Shape
    Set s = ActiveLayer.CreateArtisticText(4, 5, "H2O")
    s.Text.Story.Characters(2).Position = cdrSubscriptFontPosition
End Sub
Reply With Quote
  #9  
Old 16-05-2005, 02:45
beny04
Guest
 
Posts: n/a
Thumbs up Many thanks!

Your answers was very helpfull for me! Oberonplace seems to be the best forum for Coreldraw-Questions!
beny04
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
delete vba project from cdr file hotairballoon CorelDRAW/Corel DESIGNER VBA 1 18-05-2005 09:08
CD 10, VBA not returning true outline width Webster CorelDRAW/Corel DESIGNER VBA 1 24-11-2004 17:09
how to insert a character CHR(216)? ama CorelDRAW/Corel DESIGNER VBA 2 17-03-2004 07:55
VBA does not work with my CD 10 ! jobar CorelDRAW/Corel DESIGNER VBA 1 24-08-2003 12:38
Detect if VBA is installed (an answer and a question) reanan CorelDRAW/Corel DESIGNER VBA 3 04-12-2002 14:35


All times are GMT -5. The time now is 16:01.


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