M
Milo¹ Vukov
(Office2000 - Office2003,VB6,VBA)
Hi
i am using CustomDocumentProperties to store some informations about
document,workbook or presentation.I will show the sample of my problem.
But i will show this only for Word.
Example:
Sub AddValue()
Dim strVal As String
Debug.Print "--------------------"
strVal = CStr(Time)
On Error GoTo err_handler
Debug.Print "CHANGE to " & strVal
ThisDocument.CustomDocumentProperties("myVal").Value = strVal
Exit Sub
err_handler:
Debug.Print "ADD val " & strVal
ThisDocument.CustomDocumentProperties.Add Name:="myVal",
LinkToContent:=False, Value:=strVal, Type:=msoPropertyTypeString
End Sub
Sub PrintValue()
Debug.Print "--------------------"
Debug.Print "PRINT " &
ThisDocument.CustomDocumentProperties("myVal").Name & " | " &
ThisDocument.CustomDocumentProperties("myVal").Value
End Sub
When i run Test program
Sub Test()
AddValue
PrintValue
'pause
AddValue
PrintValue
'pause
AddValue
PrintValue
'pause
AddValue
PrintValue
'pause
AddValue
PrintValue
End Sub
It print me this
--------------------
CHANGE to 11:33:07
ADD val 11:33:07
--------------------
PRINT myVal | 11:33:07
--------------------
CHANGE to 11:33:12
--------------------
PRINT myVal | 11:33:12
--------------------
CHANGE to 11:33:15
--------------------
PRINT myVal | 11:33:15
--------------------
CHANGE to 11:33:22
--------------------
PRINT myVal | 11:33:22
--------------------
CHANGE to 11:33:26
--------------------
PRINT myVal | 11:33:26
So i suppose that in CustomProperty "myVal" is value 11:33:26, then i save
my document and close it.
When i open my document again and go to look in CustomProperties there is
value 11:33:07 ?!?!?!??!?!?
Anyone know how to save the last value or how to refresh that Word remember
it in file?
Hi
i am using CustomDocumentProperties to store some informations about
document,workbook or presentation.I will show the sample of my problem.
But i will show this only for Word.
Example:
Sub AddValue()
Dim strVal As String
Debug.Print "--------------------"
strVal = CStr(Time)
On Error GoTo err_handler
Debug.Print "CHANGE to " & strVal
ThisDocument.CustomDocumentProperties("myVal").Value = strVal
Exit Sub
err_handler:
Debug.Print "ADD val " & strVal
ThisDocument.CustomDocumentProperties.Add Name:="myVal",
LinkToContent:=False, Value:=strVal, Type:=msoPropertyTypeString
End Sub
Sub PrintValue()
Debug.Print "--------------------"
Debug.Print "PRINT " &
ThisDocument.CustomDocumentProperties("myVal").Name & " | " &
ThisDocument.CustomDocumentProperties("myVal").Value
End Sub
When i run Test program
Sub Test()
AddValue
PrintValue
'pause
AddValue
PrintValue
'pause
AddValue
PrintValue
'pause
AddValue
PrintValue
'pause
AddValue
PrintValue
End Sub
It print me this
--------------------
CHANGE to 11:33:07
ADD val 11:33:07
--------------------
PRINT myVal | 11:33:07
--------------------
CHANGE to 11:33:12
--------------------
PRINT myVal | 11:33:12
--------------------
CHANGE to 11:33:15
--------------------
PRINT myVal | 11:33:15
--------------------
CHANGE to 11:33:22
--------------------
PRINT myVal | 11:33:22
--------------------
CHANGE to 11:33:26
--------------------
PRINT myVal | 11:33:26
So i suppose that in CustomProperty "myVal" is value 11:33:26, then i save
my document and close it.
When i open my document again and go to look in CustomProperties there is
value 11:33:07 ?!?!?!??!?!?
Anyone know how to save the last value or how to refresh that Word remember
it in file?