![]() |
If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Search this Thread | Display Modes |
#1
|
|||
|
|||
![]()
Outlook 2003 (SP2)
Windows XP (SP2) (I have also posted this issue at http://www.vbaexpress.com/forum/showthread.php?t=7989 but have had no reply) Dear All – I am relatively new to this forum (and VBA in general) but hope that someone can help as I really want to complete this code so I can roll it out to a few members of my team who really NEED it (I know should use COM ADDIN but don’t know how to convert this to VB to create Addin) I have managed to piece together some code from different forums’ which accomplishes the following; • User opens new instance of a mail • When the To: & Subject: fields are empty 2 input boxes are displayed. The first asks the user to input a job number or client name the second asks the user to input a subject line. • New mail shown with the Job No/Client Name in CC field and a combination of Job No/Client Name & Subject line shown in Subject field. This ensures that the email is ‘copied’ to the correct project mailbox and that the client name or job number are referenced in the subject line of new mails. The following code works if the mail editor is Outlook however, I had a number of problems if the mail editor was word. Firstly if the editor was word the input boxes would hide behind the instance of wordmail. I found some code (provided by Samual Wright) which minimised the wordmail window so the boxes could be completed and is then meant to maximise the wordmail window again so the user can edit their mail. Unfortunately the wordmail only maximises if the their were no other instances of a word document running (eg if I have a document open then the maximise command does not work) Can someone help me either refine the minimise/maximise compoenent of the code so it works correctly or alternativly suggest a better method of accomplishing the task when word is the email editor. Code as follows; 'Thanks to Sue Mosher & Eric Legualt ‘http://blogs.officezealot.com/legaul...cles/2224.aspx for providing most of the ‘source code Sub objMailItem_Open(Cancel As Boolean) Dim objWordMail As Word.MailMessage Dim strEmail As String Dim objRecipient As Recipient Dim objSubject As String Dim objMailBody As String On Error Resume Next With objMailItem 'Code provided by Samuel Wright 'http://www.vbaexpress.com/forum _ '/showthread.php?t=6366&highlight=word+editor+outloo k (is there a better way to do this?) If ActiveInspector.IsWordMail = True Then Application.ActiveInspector.WindowState = olMinimized End If 'Select only mails where To and Subject are blank - this should only be New ‘Mails If .To = "" And .subject = "" Then 'Input messagebox for Client Name or Project Number strEmail = InputBox("Please Input Appropriate Job Number or Client Name", _ "Job Number") End If 'If user does not want to send mail to project mailbox If strEmail = "" Then Goto killSub End If objMailItem.CC = strEmail objSubject = InputBox("Please Include a Descriptive Subject", "Subject") 'Resolve the address to find the correct Project email address eg objMailItem.Recipients.ResolveAll objMailItem.subject = strEmail + " " + "-" + " " + objSubject If ActiveInspector.IsWordMail = True Then Application.ActiveInspector.WindowState = olMaximized ‘This dosnt work if another word document running End If End With killSub: With objMailItem If ActiveInspector.IsWordMail = True Then Application.ActiveInspector.WindowState = olMaximized ‘This dosnt work if another word document running End If End With End Sub Note: other treads similar to the above I have found on another forum include. http://www.vbaexpress.com/forum/showthread.php?t=6366 http://vbaexpress.com/forum/showthread.php?t=5042 http://www.vbaexpress.com/forum/showthread.php?t=6283 http://vbaexpress.com/forum/showthread.php?t=3516 |
Ads |
#2
|
|||
|
|||
![]()
Am Tue, 9 May 2006 18:10:02 -0700 schrieb Carmi:
That´s a good idea with the WindowState property. The next step should be simple: If you minimize a window and the application has other windows visible then the focus changes to the next visible window. Due to that the ActiveInspector changes. So simply declare a variable and store the reference on the Inspector you want to work with. Additionally I´d store the WindowState itself. A very short sample: Dim Inspector as Outlook.Inspector Dim WindowState As Long Set Inspector=Application.ActiveInspector WindowState=Inspector.WindowState Inspector.WindowState=olMinimized '... Inspector.WindowState=WindowState -- Viele Gruesse / Best regards Michael Bauer - MVP Outlook -- www.vbOffice.net -- Outlook 2003 (SP2) Windows XP (SP2) (I have also posted this issue at http://www.vbaexpress.com/forum/showthread.php?t=7989 but have had no reply) Dear All – I am relatively new to this forum (and VBA in general) but hope that someone can help as I really want to complete this code so I can roll it out to a few members of my team who really NEED it (I know should use COM ADDIN but don’t know how to convert this to VB to create Addin) I have managed to piece together some code from different forums’ which accomplishes the following; • User opens new instance of a mail • When the To: & Subject: fields are empty 2 input boxes are displayed. The first asks the user to input a job number or client name the second asks the user to input a subject line. • New mail shown with the Job No/Client Name in CC field and a combination of Job No/Client Name & Subject line shown in Subject field. This ensures that the email is ‘copied’ to the correct project mailbox and that the client name or job number are referenced in the subject line of new mails. The following code works if the mail editor is Outlook however, I had a number of problems if the mail editor was word. Firstly if the editor was word the input boxes would hide behind the instance of wordmail. I found some code (provided by Samual Wright) which minimised the wordmail window so the boxes could be completed and is then meant to maximise the wordmail window again so the user can edit their mail. Unfortunately the wordmail only maximises if the their were no other instances of a word document running (eg if I have a document open then the maximise command does not work) Can someone help me either refine the minimise/maximise compoenent of the code so it works correctly or alternativly suggest a better method of accomplishing the task when word is the email editor. Code as follows; 'Thanks to Sue Mosher & Eric Legualt ‘http://blogs.officezealot.com/legaul...cles/2224.aspx for providing most of the ‘source code Sub objMailItem_Open(Cancel As Boolean) Dim objWordMail As Word.MailMessage Dim strEmail As String Dim objRecipient As Recipient Dim objSubject As String Dim objMailBody As String On Error Resume Next With objMailItem 'Code provided by Samuel Wright 'http://www.vbaexpress.com/forum _ '/showthread.php?t=6366&highlight=word+editor+outloo k (is there a better way to do this?) If ActiveInspector.IsWordMail = True Then Application.ActiveInspector.WindowState = olMinimized End If 'Select only mails where To and Subject are blank - this should only be New ‘Mails If .To = "" And .subject = "" Then 'Input messagebox for Client Name or Project Number strEmail = InputBox("Please Input Appropriate Job Number or Client Name", _ "Job Number") End If 'If user does not want to send mail to project mailbox If strEmail = "" Then Goto killSub End If objMailItem.CC = strEmail objSubject = InputBox("Please Include a Descriptive Subject", "Subject") 'Resolve the address to find the correct Project email address eg objMailItem.Recipients.ResolveAll objMailItem.subject = strEmail + " " + "-" + " " + objSubject If ActiveInspector.IsWordMail = True Then Application.ActiveInspector.WindowState = olMaximized ‘This dosnt work if another word document running End If End With killSub: With objMailItem If ActiveInspector.IsWordMail = True Then Application.ActiveInspector.WindowState = olMaximized ‘This dosnt work if another word document running End If End With End Sub Note: other treads similar to the above I have found on another forum include. http://www.vbaexpress.com/forum/showthread.php?t=6366 http://vbaexpress.com/forum/showthread.php?t=5042 http://www.vbaexpress.com/forum/showthread.php?t=6283 http://vbaexpress.com/forum/showthread.php?t=3516 |
#3
|
|||
|
|||
![]()
Hi Michael - thanks for the reply. I had the windowstate property in the
code already which worked when minimising but not when maximising (if a word doc was already active). However, I have now used the .display method to maximise the mail. The following link is to the working (but not perfect) code. http://www.vbaexpress.com/forum/showthread.php?t=7989 "Michael Bauer" wrote: Am Tue, 9 May 2006 18:10:02 -0700 schrieb Carmi: That´s a good idea with the WindowState property. The next step should be simple: If you minimize a window and the application has other windows visible then the focus changes to the next visible window. Due to that the ActiveInspector changes. So simply declare a variable and store the reference on the Inspector you want to work with. Additionally I´d store the WindowState itself. A very short sample: Dim Inspector as Outlook.Inspector Dim WindowState As Long Set Inspector=Application.ActiveInspector WindowState=Inspector.WindowState Inspector.WindowState=olMinimized '... Inspector.WindowState=WindowState -- Viele Gruesse / Best regards Michael Bauer - MVP Outlook -- www.vbOffice.net -- Outlook 2003 (SP2) Windows XP (SP2) (I have also posted this issue at http://www.vbaexpress.com/forum/showthread.php?t=7989 but have had no reply) Dear All – I am relatively new to this forum (and VBA in general) but hope that someone can help as I really want to complete this code so I can roll it out to a few members of my team who really NEED it (I know should use COM ADDIN but don’t know how to convert this to VB to create Addin) I have managed to piece together some code from different forums’ which accomplishes the following; • User opens new instance of a mail • When the To: & Subject: fields are empty 2 input boxes are displayed. The first asks the user to input a job number or client name the second asks the user to input a subject line. • New mail shown with the Job No/Client Name in CC field and a combination of Job No/Client Name & Subject line shown in Subject field. This ensures that the email is ‘copied’ to the correct project mailbox and that the client name or job number are referenced in the subject line of new mails. The following code works if the mail editor is Outlook however, I had a number of problems if the mail editor was word. Firstly if the editor was word the input boxes would hide behind the instance of wordmail. I found some code (provided by Samual Wright) which minimised the wordmail window so the boxes could be completed and is then meant to maximise the wordmail window again so the user can edit their mail. Unfortunately the wordmail only maximises if the their were no other instances of a word document running (eg if I have a document open then the maximise command does not work) Can someone help me either refine the minimise/maximise compoenent of the code so it works correctly or alternativly suggest a better method of accomplishing the task when word is the email editor. Code as follows; 'Thanks to Sue Mosher & Eric Legualt ‘http://blogs.officezealot.com/legaul...cles/2224.aspx for providing most of the ‘source code Sub objMailItem_Open(Cancel As Boolean) Dim objWordMail As Word.MailMessage Dim strEmail As String Dim objRecipient As Recipient Dim objSubject As String Dim objMailBody As String On Error Resume Next With objMailItem 'Code provided by Samuel Wright 'http://www.vbaexpress.com/forum _ '/showthread.php?t=6366&highlight=word+editor+outloo k (is there a better way to do this?) If ActiveInspector.IsWordMail = True Then Application.ActiveInspector.WindowState = olMinimized End If 'Select only mails where To and Subject are blank - this should only be New ‘Mails If .To = "" And .subject = "" Then 'Input messagebox for Client Name or Project Number strEmail = InputBox("Please Input Appropriate Job Number or Client Name", _ "Job Number") End If 'If user does not want to send mail to project mailbox If strEmail = "" Then Goto killSub End If objMailItem.CC = strEmail objSubject = InputBox("Please Include a Descriptive Subject", "Subject") 'Resolve the address to find the correct Project email address eg objMailItem.Recipients.ResolveAll objMailItem.subject = strEmail + " " + "-" + " " + objSubject If ActiveInspector.IsWordMail = True Then Application.ActiveInspector.WindowState = olMaximized ‘This dosnt work if another word document running End If End With killSub: With objMailItem If ActiveInspector.IsWordMail = True Then Application.ActiveInspector.WindowState = olMaximized ‘This dosnt work if another word document running End If End With End Sub Note: other treads similar to the above I have found on another forum include. http://www.vbaexpress.com/forum/showthread.php?t=6366 http://vbaexpress.com/forum/showthread.php?t=5042 http://www.vbaexpress.com/forum/showthread.php?t=6283 http://vbaexpress.com/forum/showthread.php?t=3516 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Outlook Template with Input Boxes | [email protected] | Outlook - General Queries | 2 | April 26th 06 11:59 PM |
Where is the group policy option to enable or disable 'Word as email editor' in Outlook XP? | QH | Outlook - General Queries | 5 | April 11th 06 04:47 PM |
Use 3rd Party Editor in Outlook not Word or Built in Editor | Charles | Outlook - Installation | 1 | March 28th 06 04:32 PM |
Using Word 2003 as email editor in Outlook 2003 | John Gibb | Outlook - General Queries | 0 | March 17th 06 05:19 PM |
Unable to access Address List from Email Editor - Word | Frankie59 | Outlook - Using Contacts | 1 | January 11th 06 06:21 AM |