Outlook Macro (VBA) programming

This is a wierd one (at least to me). I'm not a VBA expert by any
means.

I want to write a macro that, when Outlook 2003 executes it, causes
Outlook to close. That's all. No other functions. Just a macro that
says "Exit" or "Close Application" or "Alt-F4".

You can imagine that this is a difficult macro to record (even if
Outlook could record macros, how would you record THAT?)
0
2/27/2004 3:20:11 PM
outlook 87535 articles. 11 followers. Follow

2 Replies
460 Views

Similar Articles

[PageSpeed] 45

For a VBA macro running in Outlook the code would be quite easy:

Sub KillOutlook()
    On Error Resume Next
    Application.Quit
End Sub

Clicking on the Close box at the top right of the Outlook window does
the same thing, why do you need a macro for that?

-- 
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Absolute Beginners Guide to Microsoft Office Outlook 2003
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


"Mark Landin" <mark.landin@tdwilliamson.com> wrote in message
news:funu30h955avspsag6lb460cerg23nrlnr@4ax.com...
> This is a wierd one (at least to me). I'm not a VBA expert by any
> means.
>
> I want to write a macro that, when Outlook 2003 executes it, causes
> Outlook to close. That's all. No other functions. Just a macro that
> says "Exit" or "Close Application" or "Alt-F4".
>
> You can imagine that this is a difficult macro to record (even if
> Outlook could record macros, how would you record THAT?)


0
kenslovak (742)
2/27/2004 4:45:49 PM
On Fri, 27 Feb 2004 11:45:49 -0500, "Ken Slovak - [MVP - Outlook]"
<kenslovak@mvps.org> wrote:

>For a VBA macro running in Outlook the code would be quite easy:
>
>Sub KillOutlook()
>    On Error Resume Next
>    Application.Quit
>End Sub
>
>Clicking on the Close box at the top right of the Outlook window does
>the same thing, why do you need a macro for that?

I'm glad you asked! :)

In this case, I need Outlook to be open just long enough to process a
new Outlook profile for the user. Once the profile is processed, I
want Outlook to close. That's all.

If Outlook had a command-line switch that basically said "process the
profile, but don't do anything else", I'd use that switch, but to my
knowledge there isn't one. Is there?


0
3/3/2004 7:49:32 PM
Reply:

Similar Artilces:

Integration of Java application with Microsoft Outlook 2003
hi, I need to interface my Java application with Microsoft Outlook 2003. I need a set of PIs for that. Can anyobdy guide me in this context? thanx. mulayarvind <arvind.mulay@gmail.com> wrote: > I need to interface my Java application with Microsoft Outlook 2003. I > need a set of PIs for that. Can anyobdy guide me in this context? Try asking in the programming group news://msnews.microsoft.com/microsoft.public.outlook.program_vba or the interoperations group news://msnews.microsoft.com/microsoft.public.outlook.interop -- Brian Tillman ...

Outlook 2003 keeps crashing #2
I get this message when I look in System information. Outlook keeps crashing quite often. I cannot for example delete two messages without outlook crashing. My colleagues do not have this problem. We are using the Microsoft mail exhange server. Faulting application outlook.exe, version 11.0.5510.0, stamp 3f1380f0, faulting module mso.dll, version 11.0.5606.0, stamp 3f334cce, debug? 0, fault address 0x003b6e16. Does anyone has a solution?=20 Best regards/ Bj=F6rn 1) I would definitely apply Service Pack 2for Office 2003 + applicable critical security updates. 2) Have you tried starting O...

Outlook needs Outlook Express to work
I've installed my Outlook 2002 on my new Vista PC (I had Xp before). Now when I start Outlook it says "requires Outlook Express 4.01 or greater". I've been looking for Outlook Express to download and install but no joy. No CD came with my new Vista PC. Any ideas, short of buying a more modern Outlook? Vista doesn't actually support Outlook 2002 or older. Outlook Express is part of Internet Explorer but with the advent of Vista, it was switched to Windows Mail. There is no more Outlook Express. You could attempt however to create a profile using workgroup or c...

"The connection to the Exchange server is unavailable. Outlook must be online or connected to complete this action"
I have setup a number of user accounts and the relative mailboxes without any problem. However, since this afternoon, if I try and connect to a newly mailbox through the email accounts wizard I get the following error message: "The connection to the Exchange server is unavailable. Outlook must be online or connected to complete this action". This also occurs when I go to File>Open>Other User's Folder... and I try and lookup an existing account/mailbox that I know I have permission to. I know Outlook is connected to the Exchange server (I can ping, send and receive emails) ...

Crash on 'Send"
My wife's Intel Celeron running ME started having this problem sporadically - now constantly. Outlook 2000 receives OK - everything seems fine until you hit the 'Send' button then Outlook crashes giving an error message that says 'Outlook has caused an error in <unknown> and has to shut down. If the problem persists you may have to restart your computer.' Re-starting however has no effect. I have re-installed Office. Used 'Detect & Repair' under the 'Help' tab, and installed all patches/updates from the Office site. But this error continues, now...

Transferring over outlook data to new XP machine
How do I transfer over my old emails, address book to my new XP machine? I have looked over the internet and found nothing the tells me EXACTLY how to do this, any help would be greatly appreciated. senior_tech@yahoo.com If your using MS Outlook copy your .PST file across and import it into the new install. >If your using MS Outlook copy your .PST file across and import it into the new install. No, don't import it. Simply use "File">"Open" -- Brian Tillman Smiths Aerospace 3290 Patterson Ave. SE, MS 1B3 Grand Rapids, MI 49512-1991 Brian.Tillman is the nam...

Outlook 2003 and "Check Names"
Hi, We are testing Outlook 2003 at our office now and there is one very frustrating "feature" that is bugging all of us. When we create a new e-mail message and type in the first name of a person from the global address book and hit ctrl- k to check the name...we get a response that Outlook doesn't recognize the name and there are "no suggestions". The only way Check Name will successfully resolve the name is if we type it last name first (ie, Gates, Bill). This was not the case in Office XP or Outlook 2000. You could search by first name (or partial first name)...

Reminders in Outlook
Since upgrading to Great Plains 9.0, several users are not getting their appointment reminders in Outlook 2003. They all show up at once after rebooting computer. Outlook settings are set appropriately. Any ideas? -- Steve ...

Personal Macro Workbook
I had some macro stored in the personal macro workbook but now I can not find the workbook. When I try to do a new macro and store it in the "Personal Macro Workbook" I get the error message "Personal Macro Workbook in the startup folder must stay open for recording". I click ok and get a message that I'm unable to record. I can record macro to other workbooks. What happened to the personal macro workbook ? Thanks ...

Outlook default to paragraph
To whom ever can help, > > When using Microsoft Outlook, and starting a new E- Mail, The default > format is to "paragraph" which double spaces. Is there anyway to > select under a New Message, Format, Style, "Normal" as the default? > > Thank you in advance > > Dave daveandivy@netidea.com >-----Original Message----- >To whom ever can help, >> >> When using Microsoft Outlook, and starting a new E- >Mail, The default >> format is to "paragraph" which double spaces. Is there >anyway to >> select unde...

Outlook "Ruler" won't go away
I don't know how I turned this on so I don't know how to turn it off. It splits my emails so that I can only type so far over before it kicks me back to the left margin and makes me start a new line. Can anyone help me? ...

Outlook 2003
Hello, we have one client pc with Outlook 2003 where the following problem occurs: if a mail is replied from a user created sub folder of the inbox, the reply will not appear in sent mails, but will end up in the same sub folder, sender and recipient appear as identical. The mail goes out properly though, it's just that Outlook sets internally sender = recipient and bounces the reply back to the subfolder in which the original mail is stored. This happens on a Win 2000 machine with SP4 and all updates, the other clients use Outlook 2000 or XP and there is no such problem. There are no ru...

cant start outlook pst file to large
Hi I hope somebody may be able to help im new to outlook and now I cant start outlook message says cannot open your default email folders pst file its too large as I cannot open outlook I cannot delete old folders See if this helps: http://support.microsoft.com/kb/296088 -- -Ben- Ben M. Schorr, MVP Roland Schorr & Tower http://www.rolandschorr.com http://www.officeforlawyers.com/outlook.html Author: The Lawyer's Guide to Microsoft Outlook 2007: http://tinyurl.com/ol4law-amazon "Ray" <Ray@discussions.microsoft.com> wrote in message news:B3B824DC-3C9B-4B1B-8EF3-61...

OutLook and Notes co-existing.
Outlook and Notes co-existing. Is is possible to mantain Notes as the primary MAPI mail server, but to have Outlook on the same machine, with a separate mail account. I wish to use the automation features of office with the outlook application, to build a solution, but the clients mail is LN. I only wish to use the system to send mails. Does LN support any objects for sending, To, Subject, Body, Attachment, etc which I could use from Access. ? Any reference material, articles etc would help also. Thanks. -- Gerry Mitas Ryemont Abbey, Leixlip, Co. Kildare Phone: 01 6104509 Fax:01 601 ...

Outlook OOF
The Out of Office Reply will not be sent outside the network. I have exchange 5.5 and have read the faqs but the only fix I found did not work. Here is the number for the fix that I found: Q176161. Thank you for your time and help, Larry 1. Make sure your Exchange server's Internet Mail Service is configured to allow Automatic Replies to the Internet; that's the most common reason it wouldn't work. 2. Reconsider if you really want to use it. You're going to automatically reply to every message you receive; including spam. That's a good way to confirm to the spammer...

Import from Eudora 6 to Outlook 2003
I am trying to import messages from Eudora 6 to Outlook 2003. I am receiving the error message "The mail folder could not be opened. If another application is using this file, please close and try again. No other applications are running Thanks for any help see article 257354 of the microsoft knowledge base on http://support.microsoft.com: "Outlook Cannot Import Eudora Messages When Eudora Mail Is Stored in a Non-Default Location" ciaos >-----Original Message----- >I am trying to import messages from Eudora 6 to Outlook 2003. I am receiving the error message ...

Moving Contacts to Outlook Address Book
Need some help. How do I move the names and email addresses from my Contacts list to my Outlook Address Book. When I click on the Outlook Address Book it is empty, but when I click on the Contacts List all the names are there. I am using Outlook 2002. Any help would be appreciated, Thanks Bob Situation normal. What is the problem? The OAB should be empty. Entries reside in the Contacts Folder. -- Russ Valentine [MVP-Outlook] "Bob R" <anonymous@discussions.microsoft.com> wrote in message news:5a2701c42d7e$3de2a7d0$a401280a@phx.gbl... > Need some help. How do I ...

outlook 98 corperate forms
In a corperate environment, Outlook 98 forms not active for using on some of the PCs. Why it happens? How can I solve this problem. ...

Outlook freezes after sending one email after upgrading 4.0
We just upgraded from 3.0 to 4.0 this weekend. All client machines have had the desktop client upgraded and 2 have the same issue. One is XP with Outlook 2003 and the other is Vista with Outlook 2007. Open opens and the CRM addin initializes correctly. As soon as you compose and send an email, Outlook locks up and you have to kill the process in task manager to close Outlook. I've had the same problem and have tried all I can think of...how did you fix this issue? Thank you. "Sander" wrote: > We just upgraded from 3.0 to 4.0 this weekend. All client machines have...

keyboard shortcut in addin macro
How do you assign a keyboard shortcut or a custom button to run a macro which is in an addin. These macros dont appear on the macro list Thanks -- Patrick Hi have a look at the OnKey method in the VBA help -- Regards Frank Kabel Frankfurt, Germany "Patrick" <Patrick@discussions.microsoft.com> schrieb im Newsbeitrag news:FBEB937C-C3FC-47BB-8E8A-EE0BBCB14DFB@microsoft.com... > How do you assign a keyboard shortcut or a custom button to run a macro which > is in an addin. > > These macros dont appear on the macro list > > Thanks > -- > Patrick Patr...

Office 2003, Outlook (Outlook Today)...
OK, this is driving me nuts. I note that w' 2003 (and XP (2002)?) the default install sets the startup folder to the Inbox. IIRC, one of the earlier Offices installed Outlook to startup w' that "all in one view" - Outlook Today. So just as a wee test - I thought I'd try that for a while, and indeed I found it quite handy to be able to see all pertinent data on the one screen. *However* (and I'm wondering if this is the case with others), I *HAVE* to use my mouse, whenever I switch to the Inbox, or Calendar, or Tasks to get the damn focus onto a 'sujbect&...

Outlook Express 6 w/multiple accounts
I have three accounts set up in Outlook Express 6. Two of them work fine, but when I reply to or forward a message sent to the third address, it uses the second address in the "from" line, so I have to change it manually. This does not happen with the other two. How do I fix this? ...

Outlook Express 5 #2
On loading, error message "MSIMN caused an invalid page fault in module DIRECTDB.dll at 017f:7dbf3070.." Appeared to coincide with display config change? Ask in an Outlook Express forum. This is an Microsoft Office Outlook forum. Outlook Express is family of Internet Explorer and Outlook of the Office family. Here is the link for the right forum http://communities.microsoft.com/newsgroups/default.asp?icp=InternetExplorer Good Luck! -- Roady [MVP] www.sparnaaij.net Microsoft Office and Microsoft Office related News Also Outlook FAQ, How To's, Downloads and more... Tip of...

Roaming Profiles & Outlook
Hi everyone, I think Microsoft should enable the use of the Microsoft Outlook Desktop Client with Roaming Profiles. I think the install process should be revised to install all the registry keys under USERS instead of CURRENT_USER in the registry to allow multiple users to use the Desktop Client on the same computer. I can't think of why Microsoft didn't think about it in the first time since a lot of users are using Outlook and are using Roaming Profiles (our client has 24000 users spread everywhere!) I hope my suggestion will be heard! Thank you, Olivier Furnémont ------...

outlook express 6.0 in ms 98
I cant seem to delete any of my sent mail messages in Outlook express 6.0 i am operaitng in ms 98..up to 8400 messages now. Please help ! At the risk of being obvious, click on the first item in your sent items folder while holding down the shift key. Then scroll to the bottom and click the last item. That will select them all - or you can use any range you desire. Then just click the delete icon or press the delete button. Once done, you might want to empty the deleted items folder (assuming it doesn't tell you there isn't enough room there and they'll be permanently delete...