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 26-01-2005, 09:47
Kristian
Guest
 
Posts: n/a
Default VB help for date field

How can I create a text field to coreldraw document where is displayed current dat + 6 months. I know that DateAdd ("m",6, Date()) works on that day change, but the problem is how to refere that text field (what is located in corel document) from VB script. And how to automate this procedure every time when I open certain document. I dont want to create that field in VB, so is it possible to refere object (text field) created in coreldraw. Sorry my bad english.
Reply With Quote
  #2  
Old 26-01-2005, 10:56
shelbym's Avatar
shelbym shelbym is offline
Senior Member
 
Join Date: Nov 2002
Location: Cheyenne, WY
Posts: 1,782
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

The following code will add the date to the lower left corner of the active page:

Code:
Sub AddDateField()

ActiveLayer.CreateArtisticText 0, 0, DateAdd("m", 6, Date)

End Sub
Hope it helps,

Shelby
Reply With Quote
  #3  
Old 27-01-2005, 00:37
Kristian
Guest
 
Posts: n/a
Default Reply:

Thanks, this helped little, Is there any change to create that field so that it could be placed anywhere in the document without managing the position in VBscript? I mean that can I place that text field as an example a picture in the document, and when I open that publish (document) next time, that field would be in same position where I saved it and the date would change, of course, every time I open the document again.
Reply With Quote
  #4  
Old 27-01-2005, 10:39
shelbym's Avatar
shelbym shelbym is offline
Senior Member
 
Join Date: Nov 2002
Location: Cheyenne, WY
Posts: 1,782
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

No problem at all (All code is for CorelDraw 12). What I would do it create and place the Artistic Text were I wanted it in the document. Then open the Object Data Docker. Were it says name enter somthing like "myTextString" This way you can refer to the Artistic Text easily via code. The code would then look somthing like this:

Code:
Sub ReplaceTextString()

Dim s As Shape
Dim t As Text

Set s = ActivePage.FindShape("myTextString")
Set t = s.Text

t.Story = DateAdd("m", 6, Date)

End Sub
Or like this:

Code:
Sub ReplaceTextString()

Dim s As Shape

Set s = ActivePage.FindShape("myTextString")
s.Text.Story = DateAdd("m", 6, Date)

End Sub

Hope that helps,

Shelby
Reply With Quote
  #5  
Old 28-01-2005, 04:14
Kristian
Guest
 
Posts: n/a
Default Vbscript

Thank you for very fast and working reply. This advice was worth of gold!
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


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


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