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 29-03-2008, 13:27
ebu
Guest
 
Posts: n/a
Default New data Field in Object Data Manager

Hello together,

how can I find out out if a Data field exist, and when it doesn´t exist how can I create a new Data Field in VBA.

... and delete after them



Ver.: CorelDraw 11

Thanks for a clue.

Last edited by ebu; 29-03-2008 at 14:11.
Reply With Quote
  #2  
Old 29-03-2008, 15:59
wOxxOm's Avatar
wOxxOm wOxxOm is offline
Senior Member
 
Join Date: Mar 2005
Posts: 836
Default

why Data fields? I like Shape.Properties, they seem more reliable
Reply With Quote
  #3  
Old 29-03-2008, 16:50
shelbym's Avatar
shelbym shelbym is offline
Senior Member
 
Join Date: Nov 2002
Location: Cheyenne, WY
Posts: 1,770
Blog Entries: 10
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 My Function...

If you use X3 or X4 you can use the DataFields.IsPresent, if not you need to write a function to do this for you. Here is one I have written.
Code:
Private Sub CheckDataItem(diName As String)
    Dim bFound As Boolean
    Dim df As DataField
    
    bFound = False
    
    For Each df In ActiveDocument.DataFields
        If df.name = diName Then
            bFound = True
            Exit For
        End If
    Next df
    
    If bFound = False Then ActiveDocument.DataFields.add diName, , True, True
End Sub
And you would call it like this:
Code:
CheckDataItem ("MyDataItemName")
I hope this helps, and if you have issues with the code please let me know.

-Shelby
Reply With Quote
  #4  
Old 30-03-2008, 00:58
ebu
Guest
 
Posts: n/a
Default

Thanks a lot. It works under Corel 11

The reason why is a Excel Import of measurement points where every Excel cell get a Data field.

e.g.
sh.ObjectData("MP").Value = a
sh.ObjectData("Nr").Value = b
and many more.

Now I can at Runtime create the fields because if I used a other PC with my GMS the fields are not available. Then I got a Error message.

regards

Last edited by ebu; 30-03-2008 at 01:09.
Reply With Quote
  #5  
Old 30-03-2008, 10:27
ebu
Guest
 
Posts: n/a
Default

Hello,

I can create a new field, but when I store the document and open the document, the field ist disappear and the text within the field "comments" at all shapes are erased.

When I create the field manual without vba, it works !

What can I do?

regards

Last edited by ebu; 30-03-2008 at 10:41.
Reply With Quote
  #6  
Old 30-03-2008, 12:39
shelbym's Avatar
shelbym shelbym is offline
Senior Member
 
Join Date: Nov 2002
Location: Cheyenne, WY
Posts: 1,770
Blog Entries: 10
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 Shapes...

If all the shapes disappear are you sure you saved the document? I do not know of a bug that makes the shapes disappear. If you post your full code and a working example we can take a look and see what it might be.

-Shelby
Reply With Quote
  #7  
Old 30-03-2008, 13:41
ebu
Guest
 
Posts: n/a
Default

Thanks for reply,

it´s only your code. I´ve create a new dokument and put only your code in it.

Then I created a circle, selected the circle and call the object data manager.
I gave the circle a name and put Text in the field "comment" (in German "Kommentare", perhaps the translation is wrong).

Now I used your macro. It created an new Field, e.g. "Field5"

Then I saved the doc und recalled the doc.

The "Field5" is disappear, also the text in the field "comment" from the circle.


Perhaps the reason is the "German Version" of Corel 11. Perhaps

regards


P.S. "Kommentare" is the third field from left and the first right from CDRStaticID
Name..Kosten....Kommentare.. CDRStatic..

Last edited by ebu; 30-03-2008 at 13:45.
Reply With Quote
  #8  
Old 02-10-2008, 14:51
mateushenrico
Guest
 
Posts: n/a
Smile Refresh DataFields

Hi everybody!

Once we could count the number of DataFields in a file, could anyone tell me how could i refresh each DataField in a file?

That's why: I have Corel files, with lots of DataFields (parts of pasted sheets). I have to open each Corel file, one by one, and double click each DataObject, choose "edit", and then exit. When i exit the Excel sheet, the DataField in my Corel file is updated.

The "refresh macro" would do it in my behalf...
Reply With Quote
  #9  
Old 04-10-2008, 02:37
shelbym's Avatar
shelbym shelbym is offline
Senior Member
 
Join Date: Nov 2002
Location: Cheyenne, WY
Posts: 1,770
Blog Entries: 10
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 Object Data Manager

Are you talking about the data fields in the Object Data Manager docker? How are they getting the data from Excel? Code?

-Shelby
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
CorelDraw and database connectivity ralfonat CorelDRAW/Corel DESIGNER VBA 12 02-11-2007 08:56
Objects in Document akayani Code Critique 9 06-02-2006 07:15
CDR12: refresh Object Manager docker after CreateSelection zlatev CorelDRAW/Corel DESIGNER VBA 2 05-03-2005 09:00
files import graphicdesigner CorelDRAW/Corel DESIGNER VBA 11 19-11-2004 23:56
Sorting entries in the object manager dan CorelDRAW/Corel DESIGNER VBA 1 18-08-2004 22:16


All times are GMT -5. The time now is 05:08.


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