![]() |
#1
|
|||
|
|||
![]()
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. |
#2
|
||||
|
||||
![]()
why Data fields? I like Shape.Properties, they seem more reliable
|
#3
|
||||
|
||||
![]()
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 Code:
CheckDataItem ("MyDataItemName") -Shelby |
#4
|
|||
|
|||
![]()
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. |
#5
|
|||
|
|||
![]()
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. |
#6
|
||||
|
||||
![]()
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 |
#7
|
|||
|
|||
![]()
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. |
#8
|
|||
|
|||
![]()
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... |
![]() |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
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 |