Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.docmanagement
Steve Steve is offline
external usenet poster
 
Posts: 298
Default Macro code for default subject line button

Hi there,

I'm after maco code for a default subject line button. When button is
clicked the subject displays my required subject.

Thanks in advanced.

Steve
  #2   Report Post  
Posted to microsoft.public.word.docmanagement
Bear[_2_] Bear[_2_] is offline
external usenet poster
 
Posts: 314
Default Macro code for default subject line button

Steve:

I'm assuming you have a situation like always writing memos or reports with
the same value for Subject (a built-in document property). This code will
change the current document's Subject property.

ActiveDocument.BuiltInDocumentProperties.Item("Sub ject") = "Default Subject
Text"

You still have to deal with having a reference to this property correctly
inserted as a field in the document.

You could create templates with a macrobutton in them that launches this
macro.

You could create a custom toolbar button and add it to an existing toolbar,
or create a custom toolbar. If you do, make sure you save that customization
in the template that contains the macro, so the button is only available when
it can be used.

Bear

--
Windows XP, Word 2000


"Steve" wrote:

Hi there,

I'm after maco code for a default subject line button. When button is
clicked the subject displays my required subject.

Thanks in advanced.

Steve

  #3   Report Post  
Posted to microsoft.public.word.docmanagement
Bear[_2_] Bear[_2_] is offline
external usenet poster
 
Posts: 314
Default Macro code for default subject line button

Steve:

And don't overlook the AUTOTEXTLIST field. You right-click this and select
from among autotext entries stored with the template. Example:

{ AUTOTEXTLIST \s "SteveSubject" \t "Right-click to select a subject." \*
MERGEFORMAT }

Bear
--
Windows XP, Word 2000


"Steve" wrote:

Hi there,

I'm after maco code for a default subject line button. When button is
clicked the subject displays my required subject.

Thanks in advanced.

Steve

  #4   Report Post  
Posted to microsoft.public.word.docmanagement
Steve Steve is offline
external usenet poster
 
Posts: 298
Default Macro code for default subject line button

Having problems here fellas.

Just to confirm, i'm running outlook 2007 which i assume creating assigned
buttons is the same as word. Not sure wether the autotext entries are
available.

In a new email window i've created a button on the quick access tab with the
following code "Sub subject()
ActiveDocument.BuiltInDocumentProperties.Item("Sub ject") = "Your Requested
quotation is attached."End Sub"

This is now failing.

I will require possibly four buttons each with a diferent subjects.

Is this the best way of doing it?

Steve

"Bear" wrote:

Steve:

And don't overlook the AUTOTEXTLIST field. You right-click this and select
from among autotext entries stored with the template. Example:

{ AUTOTEXTLIST \s "SteveSubject" \t "Right-click to select a subject." \*
MERGEFORMAT }

Bear
--
Windows XP, Word 2000


"Steve" wrote:

Hi there,

I'm after maco code for a default subject line button. When button is
clicked the subject displays my required subject.

Thanks in advanced.

Steve

  #5   Report Post  
Posted to microsoft.public.word.docmanagement
Steve Steve is offline
external usenet poster
 
Posts: 298
Default Macro code for default subject line button

The quick parts button is greyed out when the cursor is in the subject field?

"CyberTaz" wrote:

A macro really isn't necessary - in Word 2007 take a look in Help under
QuickParts and Building Blocks, in earlier versions look up AutoText.
--
HTH |:)
Bob Jones
[MVP] Office:Mac

"Steve" wrote in message
...
Hi there,

I'm after maco code for a default subject line button. When button is
clicked the subject displays my required subject.

Thanks in advanced.

Steve






  #6   Report Post  
Posted to microsoft.public.word.docmanagement
CyberTaz CyberTaz is offline
external usenet poster
 
Posts: 1,291
Default Macro code for default subject line button

A macro really isn't necessary - in Word 2007 take a look in Help under
QuickParts and Building Blocks, in earlier versions look up AutoText.
--
HTH |:)
Bob Jones
[MVP] Office:Mac

"Steve" wrote in message
...
Hi there,

I'm after maco code for a default subject line button. When button is
clicked the subject displays my required subject.

Thanks in advanced.

Steve



  #7   Report Post  
Posted to microsoft.public.word.docmanagement
CyberTaz CyberTaz is offline
external usenet poster
 
Posts: 1,291
Default Macro code for default subject line button

Sorry - since you posted to a Word group & didn't mention otherwise I
assumed you were using Word. As I don't use Outlook I'm afraid I can't help.
--
Regards |:)
Bob Jones
[MVP] Office:Mac

"Steve" wrote in message
...
The quick parts button is greyed out when the cursor is in the subject
field?

"CyberTaz" wrote:

A macro really isn't necessary - in Word 2007 take a look in Help under
QuickParts and Building Blocks, in earlier versions look up AutoText.
--
HTH |:)
Bob Jones
[MVP] Office:Mac

"Steve" wrote in message
...
Hi there,

I'm after maco code for a default subject line button. When button is
clicked the subject displays my required subject.

Thanks in advanced.

Steve






  #8   Report Post  
Posted to microsoft.public.word.docmanagement
Graham Mayor Graham Mayor is offline
external usenet poster
 
Posts: 19,312
Default Macro code for default subject line button

If you add the Outlook object library to Word's vba references, something
like

Sub Send_As_Mail_Attachment()

' send the document as an attachment _
in an Outlook Email message
Dim bStarted As Boolean
Dim oOutlookApp As Outlook.Application
Dim oItem As Outlook.MailItem

On Error Resume Next

'Prompt the user to save the document
ActiveDocument.Save

'Get Outlook if it's running
Set oOutlookApp = GetObject(, "Outlook.Application")

'Outlook wasn't running, start it from code
If Err 0 Then
Set oOutlookApp = CreateObject("Outlook.Application")
bStarted = True
End If

'Create a new mailitem
Set oItem = oOutlookApp.CreateItem(olMailItem)

With oItem
.To = "
'Set the recipient for a copy
.BCC = "
.Subject = "This is the subject"
'Add the document as an attachment, you can use the _
.displayname property
'to set the description that's used in the message
.Attachments.Add Source:=ActiveDocument.FullName, _
Type:=olByValue, DisplayName:="Document as attachment"
.Display
End With

'Clean up
Set oItem = Nothing
Set oOutlookApp = Nothing
End Sub

will work. Remove the bits you don't need.


--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org


Steve wrote:
Having problems here fellas.

Just to confirm, i'm running outlook 2007 which i assume creating
assigned buttons is the same as word. Not sure wether the autotext
entries are available.

In a new email window i've created a button on the quick access tab
with the following code "Sub subject()
ActiveDocument.BuiltInDocumentProperties.Item("Sub ject") = "Your
Requested quotation is attached."End Sub"

This is now failing.

I will require possibly four buttons each with a diferent subjects.

Is this the best way of doing it?

Steve

"Bear" wrote:

Steve:

And don't overlook the AUTOTEXTLIST field. You right-click this and
select from among autotext entries stored with the template. Example:

{ AUTOTEXTLIST \s "SteveSubject" \t "Right-click to select a
subject." \* MERGEFORMAT }

Bear
--
Windows XP, Word 2000


"Steve" wrote:

Hi there,

I'm after maco code for a default subject line button. When button
is clicked the subject displays my required subject.

Thanks in advanced.

Steve



  #9   Report Post  
Posted to microsoft.public.word.docmanagement
Steve Steve is offline
external usenet poster
 
Posts: 298
Default Macro code for default subject line button

To anyone interested, the following code works a treat.

Sub MySubject()
Dim itm as Object
On Error Resume Next
Set itm = Application.ActiveInspector.CurrentItem
itm.Subject = "My Subject"
set itm = Nothing
End Sub


"Graham Mayor" wrote:

If you add the Outlook object library to Word's vba references, something
like

Sub Send_As_Mail_Attachment()

' send the document as an attachment _
in an Outlook Email message
Dim bStarted As Boolean
Dim oOutlookApp As Outlook.Application
Dim oItem As Outlook.MailItem

On Error Resume Next

'Prompt the user to save the document
ActiveDocument.Save

'Get Outlook if it's running
Set oOutlookApp = GetObject(, "Outlook.Application")

'Outlook wasn't running, start it from code
If Err 0 Then
Set oOutlookApp = CreateObject("Outlook.Application")
bStarted = True
End If

'Create a new mailitem
Set oItem = oOutlookApp.CreateItem(olMailItem)

With oItem
.To = "
'Set the recipient for a copy
.BCC = "
.Subject = "This is the subject"
'Add the document as an attachment, you can use the _
.displayname property
'to set the description that's used in the message
.Attachments.Add Source:=ActiveDocument.FullName, _
Type:=olByValue, DisplayName:="Document as attachment"
.Display
End With

'Clean up
Set oItem = Nothing
Set oOutlookApp = Nothing
End Sub

will work. Remove the bits you don't need.


--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org


Steve wrote:
Having problems here fellas.

Just to confirm, i'm running outlook 2007 which i assume creating
assigned buttons is the same as word. Not sure wether the autotext
entries are available.

In a new email window i've created a button on the quick access tab
with the following code "Sub subject()
ActiveDocument.BuiltInDocumentProperties.Item("Sub ject") = "Your
Requested quotation is attached."End Sub"

This is now failing.

I will require possibly four buttons each with a diferent subjects.

Is this the best way of doing it?

Steve

"Bear" wrote:

Steve:

And don't overlook the AUTOTEXTLIST field. You right-click this and
select from among autotext entries stored with the template. Example:

{ AUTOTEXTLIST \s "SteveSubject" \t "Right-click to select a
subject." \* MERGEFORMAT }

Bear
--
Windows XP, Word 2000


"Steve" wrote:

Hi there,

I'm after maco code for a default subject line button. When button
is clicked the subject displays my required subject.

Thanks in advanced.

Steve




Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to add a subject line to mails sent thru mail merge Jaga Mailmerge 3 August 21st 06 10:13 AM
MS Word - SendMail - Autopopulate Recipient+Subject Using A Macro? Garrett Microsoft Word Help 3 February 26th 06 09:21 AM
How can I see a text code, such as the code for 'line return'? Blackhawk Microsoft Word Help 3 January 26th 06 09:15 PM
How do I get a subject line on mail merged emails? Matt_hull1979 Microsoft Word Help 1 October 8th 05 05:37 PM
Unique Subject Line Sam Mailmerge 0 January 20th 05 06:59 AM


All times are GMT +1. The time now is 11:43 AM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"