On Reflection
From: OHM \( Terry Burns \) (me_at_mine.com)
Date: 12/24/04
- Next message: MAKS_at_India: "Query related to smart documents"
- Previous message: Alex: "Saving entries in forms"
- In reply to: OHM \( Terry Burns \): "Cracked it !"
- Messages sorted by: [ date ] [ thread ]
Date: Fri, 24 Dec 2004 10:59:15 -0000
These commands were superceeded by the BuiltInProperty collection
DocumentProperty values, however there seems to be some difference in the
way they work.
I know Im missing something here, there must be a way of registering the
title as one of the contents of the document, I just dont know how. I would
like to be able to do this without regressing to Wordbasic command set which
will doubtless be unsupported in a later date.
ALSO
I have noticed with the template I sent you that if you double click on it
to create a new document, it takes a long while to finish up the macro and
get back to the document, whereas if you use the File | New Templates On My
Computer then it works OK.
so . . .
Is double clicking a supported method of working or if not, why would this
be happening?
Sorry for bugging you, but you are almost the only one who has been willing
to help on this .
#
Many Thank - Terry
--
OHM ( Terry Burns ) * Use the following to email me *
Dim ch() As Char = "ufssz/cvsotAhsfbuTpmvujpotXjui/OFU".ToCharArray()
For i As Int32 = 0 To ch.Length - 1
ch(i) = Convert.ToChar(Convert.ToInt16(ch(i)) - 1)
Next
Process.Start("mailto:" & New String(ch))
--
"OHM ( Terry Burns )" <me@mine.com> wrote in message
news:OVdeGYa6EHA.2876@TK2MSFTNGP12.phx.gbl...
> This instantly registers the Title into the contents of the document so
> its not lost. I think title seems to be the only property affected because
> it is part of the Content listing. I found this by looking in a Letter
> Wizard an just tried it as a last straw.
>
> WordBasic.FileSummaryInfo Title:=Me.subjectTextBox.Text
>
> --
> OHM ( Terry Burns ) * Use the following to email me *
>
> Dim ch() As Char = "ufssz/cvsotAhsfbuTpmvujpotXjui/OFU".ToCharArray()
> For i As Int32 = 0 To ch.Length - 1
> ch(i) = Convert.ToChar(Convert.ToInt16(ch(i)) - 1)
> Next
> Process.Start("mailto:" & New String(ch))
> --
> "OHM ( Terry Burns )" <me@mine.com> wrote in message
> news:exLpxBa6EHA.2196@TK2MSFTNGP14.phx.gbl...
>>I think its easier if I just post the document. If you create a new
>>document based on this template. and try and save it you will find it will
>>default to the first address line. Why ?, because the title apparently is
>>not set.
>>
>> Here's the Rub, when you create the document, afer filling in the
>> userform three text boxes, Address, Subject and Dear ???, you check the
>> properties and discover that the title exists in the summary ***, but
>> no title exists in the content.
>>
>> Cancel this dialog, then go back and check it again, voila, the title has
>> disapeared !. I dont want to save it at this point, but even if I do, the
>> title is still blank so it default to the address line. Try it !
>>
>> I'm a patient man, but my machine is beginning to look more like a
>> footbal with each passing hour, this is a really simple need and Im
>> frustrated with the damn thing.
>>
>> --
>> OHM ( Terry Burns ) * Use the following to email me *
>>
>> Dim ch() As Char = "ufssz/cvsotAhsfbuTpmvujpotXjui/OFU".ToCharArray()
>> For i As Int32 = 0 To ch.Length - 1
>> ch(i) = Convert.ToChar(Convert.ToInt16(ch(i)) - 1)
>> Next
>> Process.Start("mailto:" & New String(ch))
>> --
>> "Peter" <peterguy -at- hotmail -dot- com> wrote in message
>> news:eWvN1GV6EHA.1864@TK2MSFTNGP10.phx.gbl...
>> The problem is not the title of the template, it's just that you need to
>> explicitly save the document after changing the title.
>> Simply invoking ActiveDocument.Save isn't enough, since changing the
>> title doesn't make the document "dirty" so .Save does nothing. Before
>> invoking ActiveDocument.Save, invoke ActiveDocument.Saved = False in
>> order to force the document to save. Why changing the title doesn't
>> "dirty" the document beats me.
>>
>> I put the following sub in the ThisDocument module of a template, then
>> created a document based on it. It changed the title of the document
>> every time (after the initial creation, naturally).
>>
>> Private Sub Document_Open()
>> Dim sTitle As String
>>
>> If ActiveDocument.Type = wdTypeDocument Then
>>
>> sTitle = ActiveDocument.BuiltInDocumentProperties("Title").Value
>>
>> MsgBox "Old Title: " & sTitle
>>
>> On Error Resume Next
>> sTitle = CStr(CInt(sTitle) + 1)
>> If Err Then
>> sTitle = "0"
>> End If
>> On Error GoTo 0
>>
>> MsgBox "New Title: " & sTitle
>>
>> ActiveDocument.BuiltInDocumentProperties("Title").Value = sTitle
>> ActiveDocument.Saved = False
>> ActiveDocument.Save
>> End If
>> End Sub
>>
>> hth,
>>
>> -Peter
>>
>>
>> "OHM ( Terry Burns )" <me@mine.com> wrote in message
>> news:eAdhexS6EHA.824@TK2MSFTNGP11.phx.gbl...
>>> Actually, the problem is something else completely. I found that my
>>> template
>>> somehow had gotten a value in the title field, and if this happen,
>>> setting
>>> the Title Field Programatically does not affect the documents content
>>> value.
>>>
>>> I cleared this and re-ran it, it would seem to work fine. However, from
>>> an
>>> academic point of view I would like to know
>>>
>>> 1.) Why this happens
>>> 2.) How to change what appears in the document content tab in the
>>> properties
>>> dialog.
>>>
>>> Hope you can help, I hate things I dont understand !
>>>
>>>
>>> --
>>> OHM ( Terry Burns ) * Use the following to email me *
>>>
>>> Dim ch() As Char = "ufssz/cvsotAhsfbuTpmvujpotXjui/OFU".ToCharArray()
>>> For i As Int32 = 0 To ch.Length - 1
>>> ch(i) = Convert.ToChar(Convert.ToInt16(ch(i)) - 1)
>>> Next
>>> Process.Start("mailto:" & New String(ch))
>>> --
>>> "Peter" <peterguy -at- hotmail -dot- com> wrote in message
>>> news:%23e0spsS6EHA.2572@tk2msftngp13.phx.gbl...
>>> Hmm.... I found that both methods work for me, BUT, I did find what
>>> seems to
>>> me to be a bug in Word:
>>>
>>> When the Title (probably applies to other properties, too) is set, then
>>> the
>>> document must be saved for the change to apply. Changing a Document
>>> Property apparently does not set the document state to dirty, so it is
>>> not
>>> automatically saved upon closing.
>>>
>>> So, using .Value will work, as will your method, you just have to
>>> explicitly
>>> save the document.
>>>
>>> hth,
>>>
>>> -Peter
>>>
>>> "OHM ( Terry Burns )" <me@mine.com> wrote in message
>>> news:uLoHNiS6EHA.2876@TK2MSFTNGP12.phx.gbl...
>>> > Thanks, but I was doing the equivelent of this anyway. However, in a
>>> > strange
>>> > quirk of fate I stumbled on a solution. It would appear that if you
>>> > set
>>> > the
>>> > value of a property, ( at least for this particular one ), that it
>>> > does
>>> > not
>>> > initialise properly, leaving out the property like so works fine.
>>> >
>>> >
>>> > ActiveDocument.BuiltInDocumentProperties("Title") = "New Title"
>>> >
>>> > Thanks for trying to help anyway, if you know why this is I would be
>>> > interested to find the cause
>>> >
>>> >
>>> > --
>>> > OHM ( Terry Burns ) * Use the following to email me *
>>> >
>>> > Dim ch() As Char = "ufssz/cvsotAhsfbuTpmvujpotXjui/OFU".ToCharArray()
>>> > For i As Int32 = 0 To ch.Length - 1
>>> > ch(i) = Convert.ToChar(Convert.ToInt16(ch(i)) - 1)
>>> > Next
>>> > Process.Start("mailto:" & New String(ch))
>>> > --
>>> > "Peter" <peterguy -at- hotmail -dot- com> wrote in message
>>> > news:eNmHL9R6EHA.992@TK2MSFTNGP12.phx.gbl...
>>> > Try this:
>>> >
>>> > Dim prop As DocumentProperty
>>> > Set prop = ActiveDocument.BuiltInDocumentProperties("Title")
>>> > prop.Value = "My new Title"
>>> >
>>> > You can also cut out the dim and set statements and simply do:
>>> > ActiveDocument.BuiltInDocumentProperties("Title").Value = "My new
>>> > title"
>>> >
>>> > The above worked for me in Word 2002.
>>> >
>>> > hth,
>>> >
>>> > -Peter
>>> >
>>> > "OHM ( Terry Burns )" <me@mine.com> wrote in message
>>> > news:%23kVjqkR6EHA.3336@TK2MSFTNGP11.phx.gbl...
>>> > > Sorry, this is a second post, but now its at the right level
>>> > >
>>> > > Can someone tell me where to set the following in vb code please
>>> > >
>>> > > When you open up the document properties. There is a tab called
>>> > > contents
>>> > > in
>>> > > a blank document the word Title appears, and this can have entries
>>> > > below
>>> > > it.
>>> > >
>>> > > What does this tab represent
>>> > > How to access the contents programatically
>>> > >
>>> > >
>>> > > TIA
>>> > >
>>> > >
>>> > > --
>>> > > OHM ( Terry Burns ) * Use the following to email me *
>>> > >
>>> > > Dim ch() As Char =
>>> > > "ufssz/cvsotAhsfbuTpmvujpotXjui/OFU".ToCharArray()
>>> > > For i As Int32 = 0 To ch.Length - 1
>>> > > ch(i) = Convert.ToChar(Convert.ToInt16(ch(i)) - 1)
>>> > > Next
>>> > > Process.Start("mailto:" & New String(ch))
>>> > > --
>>
>>
>>
>
>
- Next message: MAKS_at_India: "Query related to smart documents"
- Previous message: Alex: "Saving entries in forms"
- In reply to: OHM \( Terry Burns \): "Cracked it !"
- Messages sorted by: [ date ] [ thread ]