![]() |
#1
|
|||
|
|||
![]()
For my current project I need to store a couple of values safely within the document.
After a little research I found that the Document.DataFields collection might be suitable for the task. I was able to make sense out of most of the parameters that are interesting to me. However I haven't been able to find out how the DataField.DataType is encoded. From what I have gathered so far it seems like the datatype 0 stands for String while 1 means Double. Am I right in assuming that? Are there any further numbers for Integer, Boolean and so on? I have not been able to find a book or ressource that covers the topic. Is there any? Thanks! |
#2
|
||||
|
||||
![]()
Might I suggest that you use Document Properties instead. I find it to be a more reliable way to store data in the document. Here is a little example for the help file:
Code:
Sub Test() Const MyMacroName As String = "MyTestMacro" With ActiveDocument .Properties(MyMacroName, 1) = "My String 1" ' String .Properties(MyMacroName, 2) = 1 ' Integer .Properties(MyMacroName, 3) = Atn(1) * 4 ' Double MsgBox .Properties(MyMacroName, 1) MsgBox .Properties(MyMacroName, 2) MsgBox .Properties(MyMacroName, 3) End With End Sub -Shelby |
#3
|
|||
|
|||
![]()
Thanks for the answer.
Can you please give some detail why you find the DataFields collection unreliable? What would be the benefit of using Document Properties instead? I have now played around with Documents.DataFields a bit and until now it seems like it works as expected. (I still have to find out what the datatype values mean though.) Andreas |
#4
|
||||
|
||||
![]()
I have one Macro that uses DataFields a lot, and every so often something seems to get crossed and you have to reboot in order to get things working it. It could just be my macro, but I have yet to find the cause, except that it does seem to be DataFields related.
The biggest advantage to Document.Properties is that they are hidden to the user, the user cannot change or modify them, they can the DataFields. Go ahead and use DataFields, if you run into problems let me know, I would love to find the solution to my issue. -Shelby |
#5
|
|||
|
|||
![]()
Hi Shelby,
Along the same lines as storing values on a document in properties... Do you know if there is a way to store custom hidden values on a shape level? Shape.Properties cannot be used like a method. Thanks much, Craig |
#7
|
|||
|
|||
![]()
Hi,
I use shape properties all the time. Just look at the help item for the syntax. You can store invisible properties in the Document, Page , Layer and Shape objects. -James |
#9
|
|||
|
|||
![]()
Very Nice! Thanks James...
|
#10
|
|||
|
|||
![]() Quote:
In my case all properties defined in this way (for document or shape) are valid only for the present session when document is open. THEY CAN NOT BE SAVED WITH THE DOCUMENT. Is there a trick/setting to make them to be saved with the document? ![]() |
![]() |
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 |
help correct code | buga | Macros/Add-ons | 1 | 24-10-2011 15:34 |
Please revise my code | beczukdavid | Code Critique | 3 | 02-07-2009 00:15 |
[useful code] | wOxxOm | CorelDRAW/Corel DESIGNER VBA | 0 | 19-12-2007 15:00 |
[useful code] sortDelimitedText | wOxxOm | CorelDRAW/Corel DESIGNER VBA | 0 | 19-12-2007 14:51 |
v11 code in v13 | diwin | CorelDRAW/Corel DESIGNER VBA | 5 | 26-06-2007 18:43 |