Saving Documents With Subject

  • Thread starter OHM \( Terry Burns \)
  • Start date
O

OHM \( Terry Burns \)

HI

There is probably a real easy solution to my question but here goes.

I want to save letters with the default name being the subject line of the
letter. When I say subject, Im not talking about the document information,
but the acutal line on the letter

Subject: This is the subject I want to use as the default filename

I want to prefix it with the initials of the current user so the document
should be saved something like

TB-This is the subject I want to use as the default filename


Any help would be appreciated

Many Thanks
 
S

Suzanne S. Barnhill

The default filename that Word proposes is one of the following:

1. The first text in the document, up to the first punctuation mark or
line/paragraph break.

2. The text in the Title field of the document Properties. If the Title
field of the document template is not empty, the Title field of the template
will be propagated to the document.

Unless the subject line is the first (non-header) text in the document (1)
doesn't do you any good, but you can use (2) if your template includes a
UserForm to ask for the subject. This can then be written to the Title
property and automatically inserted in the document as the subject line via
a Title or DocProperty field in the template.
 
O

OHM \( Terry Burns \)

Thanks for your reply. I can fill the title field with this code.

Application.ActiveDocument.BuiltInDocumentProperties(WdBuiltInProperty.wdPropertyTitle)
= _
Application.ActiveDocument.FormFields.Item(1).Result

However, Im not sure how to keep the field from getting deleted. I dragged a
texbox to the subject line but two things elude me.

1.) How to Enter ( and hence run a macro ) the field

2.) How to Exit ( and do the same ) and stop the field getting deleted.



--
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))
--
 
O

OHM \( Terry Burns \)

Actually, I think ive worked this out. You have to protect the document.

One other question. IS there an way of filling in the field with a date when
created


--
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))
--
 
O

OHM \( Terry Burns \)

Solved that too

--
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))
--
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top