A Microsoft Outlook email forum. Outlook Banter

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.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Why did my macro suddenly stop working?



 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1  
Old March 14th 06, 04:48 PM posted to microsoft.public.outlook.program_vba
Dale
external usenet poster
 
Posts: 15
Default Why did my macro suddenly stop working?

Hello all,

I have the following Outlook macro which has stopped working/is behaving
erratically between machines. It's always behaved perfectly before.

We have a client who sends 15 text files embedded in an email (not an
attachment). We have to save them out as text files to our network.

"If TypeOf obj Is Outlook.MailItem" seems to be the culprit.
ExportMailToTxt is just bypassed.

I have no idea why it would suddenly stop working. The only thing I can
come up with is something in the client's emails are playing havoc with the
macro.

Can anyone give me a clue to this puzzle?



Public Sub SAVESALES() 'LoopMailFolder()

Dim oSel As Outlook.Selection
Dim obj As Object
Dim cnt As Long
Dim SALEDate As String

Set oSel = Application.ActiveExplorer.Selection
cnt = oSel.Count

SALEDate = InputBox("What is today's date?")

If cnt = 15 Then
For i = 1 To cnt
Set obj = oSel(i)
If TypeOf obj Is Outlook.MailItem Then ' ///Item is not recognized
as a MailItem?
ExportMailToTxt obj, Chr$(96 + i), SALEDate ' ///This code is
bypassed
End If
Next
End If

Shell "d:\Program Files\UltraEdit\uedit32.exe Q:efiles\email\sale" &
SALEDate & "*.txt", vbNormalFocus

End Sub

Public Function ExportMailToTxt(oMail As Outlook.MailItem, _
sExt As String, sDate As String _
) As Boolean
On Error Resume Next
Dim sPath As String: sPath = "Q:efiles\email\" '"c:\"
Dim sName As String

sName = "SALE" & sDate _
& sExt & ".txt"
oMail.SaveAs sPath & sName, olTXT
ExportMailToTxt = (Err.Number = 0)
End Function



 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Why did retriving mail from all acounts stop working? Web Office Support Outlook - Installation 1 May 26th 06 06:08 PM
All accounts suddenly stop working... mikelee101 Outlook Express 8 March 13th 06 04:52 PM
Suddenly cannot see anything in Inbox Angus Comber Outlook Express 2 January 24th 06 07:40 PM
nicknames stopped working suddenly Gordon Prince, MCP Outlook - General Queries 3 January 19th 06 01:38 AM
spell checker stop working after I installed windows xp JC Outlook - General Queries 1 January 8th 06 12:08 AM


All times are GMT +1. The time now is 12:54 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.