Link to home
Start Free TrialLog in
Avatar of Slightly_Imperfect
Slightly_Imperfect

asked on

attachmentcount failing to initialize

I have wrote a rotine in vb that sends out an email with attachments!!! all this works fine and dandy until it goes through the routine again because it is not setting attachmentcount and attachmentindex back to zero !!!! so the second time through it falls over with invalid property value !!!!  if anyone coud help on this i would be pleased as punch !!!!


cheers

mike
Avatar of hes
hes
Flag of United States of America image

Post some of your code
I always set it back to 0

MapiMess.AttachmentCount = 0
MapiMess.AttachmentIndex = 0
MapiMess.AttachmentPathName = "Name"
MapiMess.AttachmentPosition = 0
MapiMess.AttachmentType = vbAttachTypeData
Avatar of wesleystewart
wesleystewart

Sounds like a scope(not the mouthwash) issue?  Can you post the routine?

Wes
Avatar of Slightly_Imperfect

ASKER

MAPISess1.DownLoadMail = False
          MAPISess1.LogonUI = False
          MAPISess1.Action = SESSION_SIGNON
           MAPIMess1.SessionID = MAPISess1.SessionID
           MAPIMess1.MsgIndex = -1
           MAPIMess1.RecipType = 1
           MAPIMess1.RecipDisplayName = "pauline_ennis@clearwater-consulting.co.uk"
           MAPIMess1.AddressResolveUI = False
           MAPIMess1.ResolveName
           MAPIMess1.MsgSubject = "Ellis and Everard weekly events email"
           MAPIMess1.MsgNoteText = "The document is attached "
            Match = Dir$("c:\download\eande\weekly\*.txt", vbNormal)
            Do While Match <> ""
              With MAPIMess1
               .AttachmentIndex = MAPIMess1.AttachmentCount
               .AttachmentName = Match
               .AttachmentPathName = "c:\download\eande\weekly\" & Match
               .AttachmentPosition = (MAPIMess1.AttachmentIndex * 2) + MAPIMess1.AttachmentIndex
              End With
              Match = Dir()
            Loop
            Match = Dir$("c:\download\ellweek.doc", vbNormal)
            Do While Match <> ""
              With MAPIMess1
               .AttachmentIndex = MAPIMess1.AttachmentCount
               .AttachmentName = Match
               .AttachmentPathName = "c:\download\" & Match
               .AttachmentPosition = (MAPIMess1.AttachmentIndex * 2) + MAPIMess1.AttachmentIndex
              End With
              Let i = i + 1
              Match = Dir()
            Loop
            MAPIMess1.Send False
            MAPISess1.Action = SESSION_SIGNOFF
            MAPISess1.DownLoadMail = True
            MAPISess1.LogonUI = True
            MAPISess1.Action = SESSION_SIGNON
            MAPISess1.Action = SESSION_SIGNOFF

Here is the code for you i tryed initializing it and it said that Attachmentcount was only a read property !!!! strange huh !!!!
When I look at this code:

Do While Match <> ""
              With MAPIMess1
               .AttachmentIndex = MAPIMess1.AttachmentCount
               .AttachmentName = Match
               .AttachmentPathName = "c:\download\eande\weekly\" & Match
               .AttachmentPosition = (MAPIMess1.AttachmentIndex * 2) + MAPIMess1.AttachmentIndex
              End With
              Match = Dir()
            Loop


This might not be a problem at all, but it looks awkward to me.

Where's the rest of the code?  Somewhere we have to declare these variables, and I think that's where the problem is.  Specifically, I think MAPISess1 or MAPIMess1 might not be declared properly or in the right place.

Wes
Adjusted points from 25 to 40
!! cheers wes for the help these are the variables

Const SESSION_SIGNOFF = 2
Const SESSION_SIGNON = 1
Const RECIPTYPE_NO = 1
Const MESSAGE_COMPOSE = 6
Const MESSAGE_SEND = 3
Const MESSAGE_RESOLVENAME = 13

Dim Match As String
Dim i As Integer
:---------------------------------------
and here is the code
          MAPISess1.DownLoadMail = False
          MAPISess1.LogonUI = False
          MAPISess1.Action = SESSION_SIGNON
           MAPIMess1.SessionID = MAPISess1.SessionID
           MAPIMess1.MsgIndex = -1
           MAPIMess1.RecipType = 1
           MAPIMess1.RecipDisplayName = ""
           MAPIMess1.AddressResolveUI = False
           MAPIMess1.ResolveName
           MAPIMess1.MsgSubject = "weekly events email"
           MAPIMess1.MsgNoteText = "The document is attached "
            Match = Dir$("c:\download\eande\weekly\*.txt", vbNormal)
            Do While Match <> ""
              With MAPIMess1
               .AttachmentIndex = MAPIMess1.AttachmentCount
               .AttachmentName = Match
               .AttachmentPathName = "c:\download\eande\weekly\" & Match
               .AttachmentPosition = (MAPIMess1.AttachmentIndex * 2) + MAPIMess1.AttachmentIndex
              End With
              Match = Dir()
            Loop
            Match = Dir$("c:\download\ellweek.doc", vbNormal)
            Do While Match <> ""
              With MAPIMess1
               .AttachmentIndex = MAPIMess1.AttachmentCount
               .AttachmentName = Match
               .AttachmentPathName = "c:\download\" & Match
               .AttachmentPosition = (MAPIMess1.AttachmentIndex * 2) + MAPIMess1.AttachmentIndex
              End With
              Let i = i + 1
              Match = Dir()
            Loop
            MAPIMess1.Send False
            MAPISess1.Action = SESSION_SIGNOFF
            MAPISess1.DownLoadMail = True
            MAPISess1.LogonUI = True
            MAPISess1.Action = SESSION_SIGNON
            MAPISess1.Action = SESSION_SIGNOFF



The only problem i really face is initializing the attachmentcount property!!!! i do not know whether i am being a dummy but i cannot seem to initialize it !!!! is there a certain way to do this ? or a certain place to do this ?  because everytime i try to initialize it a message appears saying it is read only !!!!   and by the way cheers everyone for your help :@)
I think we're still missing some code.  I don't see MAPIMess1 or MAPISess1 being declared anywhere, nor is there a Sub()...End Sub() structure.

I think you keep reusing the same MAPIMess1, rather than instantiating a new object for each message.  Since AttachmentCount is read-only, it doesn't change until you instantiate a new message object.

Wes
i did not post all the code because it is doing all sorts of wierd and wonderful stuff in excel !!!!

how do you reset the the mapisession ? is it with new session ? or is it when you signoff !!!

the problem i was facing with using the sign on was it started dailing out before it had put the mail in the outbox!!!!  

Thanks for your time on this it is well appreciated !!!!

i reckon we are well on the way to solving it !!!

cheers

mike

I think the problem is the scope of the variables.  The only way we'll know is to see the whole module.

Wes
here we go the full lot !!!!

mind the code it repeats quite abit could rewrite it but that would take time!!! was written a bit back !!! could have put the reads into a procedure but never mind it works even though it looks bad !!!!


Dim Month_Name As String
Dim Match As String
Dim i As Integer
Month_Name = Format(Now, "mmmm")

Open "c:\download\Transfer.bat" For Output As #1
Print #1, "cd \"
Print #1, "cd download"
Print #1, "ftp -n -s:unix 192.168.100.1"
Close #1

Open "c:\download\unix" For Output As #1
Print #1, "user root openview"
Print #1, "cd /opt/OV/contrib/CCL/CCL/MikeScripts/testing/Weekly/Reports"
Print #1, "lcd c:\download\eande\Weekly"
Print #1, "mget *.*"
Print #1, "y"
Print #1, "y"
Print #1, "y"
Print #1, "y"
Print #1, "y"
Print #1, "y"
Print #1, "y"
Print #1, "y"
Print #1, "y"
Print #1, "y"
Print #1, "y"
Print #1, "y"
Print #1, "y"
Print #1, "y"
Print #1, "y"
Print #1, "y"
Print #1, "cd /opt/OV/contrib/CCL/CCL/MikeScripts/testing/Weekly/DATA"
Print #1, "mget *.txt"
Print #1, "y"
Print #1, "y"
Print #1, "y"
Print #1, "y"
Print #1, "bye"
Close #1
ExecCmd "c:\download\eande\weekly\cdown.bat"

ExecCmd "c:\download\transfer.bat"

' kill the old error file
If Dir$("c:\download\error.log") <> "" Then
    Kill "c:\download\error.log"
End If

If Dir$("c:\download\report.doc") <> "" Then
    Kill "c:\download\report.doc"
End If

'Check to see if the files exist !!!
If Dir$("c:\download\eande\Weekly\msgrpt." + Month_Name + ".AIX.Ellis.h70_1") = "" Then
    Open "c:\download\error.log" For Append As #1
    Print #1, "The file msgrpt." + Month_Name + ".AIX.Ellis.h70_1" + " Does not Exist"
    Close #1
End If

If Dir$("c:\download\eande\Weekly\msgrpt." + Month_Name + ".AIX.Ellis.s80_1") = "" Then
    Open "c:\download\error.log" For Append As #1
    Print #1, "The file msgrpt." + Month_Name + ".AIX.Ellis.s80_1" + " Does not Exist"
    Close #1
End If


If Dir$("c:\download\eande\Weekly\msgrpt." + Month_Name + ".AIX.Ellis.hp104") = "" Then
    Open "c:\download\error.log" For Append As #1
    Print #1, "The file msgrpt." + Month_Name + ".AIX.Ellis.hp104" + " Does not Exist"
    Close #1
End If



If Dir$("c:\download\eande\Weekly\msgrpt." + Month_Name + ".Baan.Ellis.h70_1") = "" Then
    Open "c:\download\error.log" For Append As #1
    Print #1, "The file msgrpt." + Month_Name + ".Baan.Ellis.h70_1" + " Does not Exist"
    Close #1
End If

If Dir$("c:\download\eande\Weekly\msgrpt." + Month_Name + ".Baan.Ellis.s80_1") = "" Then
    Open "c:\download\error.log" For Append As #1
    Print #1, "The file msgrpt." + Month_Name + ".Baan.Ellis.s80_1" + " Does not Exist"
    Close #1
End If

If Dir$("c:\download\eande\Weekly\msgrpt." + Month_Name + ".Baan.Ellis.hp104") = "" Then
    Open "c:\download\error.log" For Append As #1
    Print #1, "The file msgrpt." + Month_Name + ".Baan.Ellis.hp104" + " Does not Exist"
    Close #1
End If

If Dir$("c:\download\eande\Weekly\msgrpt." + Month_Name + ".Hardware.Ellis.h70_1") = "" Then
    Open "c:\download\error.log" For Append As #1
    Print #1, "The file msgrpt." + Month_Name + ".Hardware.Ellis.h70_1" + " Does not Exist"
    Close #1
End If

If Dir$("c:\download\eande\Weekly\msgrpt." + Month_Name + ".Hardware.Ellis.s80_1") = "" Then
    Open "c:\download\error.log" For Append As #1
    Print #1, "The file msgrpt." + Month_Name + ".Hardware.Ellis.s80_1" + " Does not Exist"
    Close #1
End If

If Dir$("c:\download\eande\Weekly\msgrpt." + Month_Name + ".Hardware.Ellis.hp104") = "" Then
    Open "c:\download\error.log" For Append As #1
    Print #1, "The file msgrpt." + Month_Name + ".Hardware.Ellis.hp104" + " Does not Exist"
    Close #1
End If


If Dir$("c:\download\eande\Weekly\msgrpt." + Month_Name + ".Informix.Ellis.h70_1") = "" Then
    Open "c:\download\error.log" For Append As #1
    Print #1, "The file msgrpt." + Month_Name + ".Informix.Ellis.h70_1" + " Does not Exist"
    Close #1
End If

If Dir$("c:\download\eande\Weekly\msgrpt." + Month_Name + ".Informix.Ellis.s80_1") = "" Then
    Open "c:\download\error.log" For Append As #1
    Print #1, "The file msgrpt." + Month_Name + ".Informix.Ellis.s80_1" + " Does not Exist"
    Close #1
End If

If Dir$("c:\download\eande\Weekly\msgrpt." + Month_Name + ".Informix.Ellis.hp104") = "" Then
    Open "c:\download\error.log" For Append As #1
    Print #1, "The file msgrpt." + Month_Name + ".Informix.Ellis.hp104" + " Does not Exist"
    Close #1
End If

If Dir$("c:\download\eande\Weekly\msgrpt." + Month_Name + ".summary" + ".Ellis.hp104") = "" Then
    Open "c:\download\error.log" For Append As #1
    Print #1, "The file msgrpt." + Month_Name + ".summary" + ".Ellis.hp104" + " Does not Exist"
    Close #1
End If

If Dir$("c:\download\eande\Weekly\msgrpt." + Month_Name + ".summary" + ".Ellis.s80_1") = "" Then
    Open "c:\download\error.log" For Append As #1
    Print #1, "The file msgrpt." + Month_Name + ".summary" + ".Ellis.s80_1" + " Does not Exist"
    Close #1
End If

If Dir$("c:\download\eande\Weekly\msgrpt." + Month_Name + ".summary" + ".Ellis.h70_1") = "" Then
    Open "c:\download\error.log" For Append As #1
    Print #1, "The file msgrpt." + Month_Name + ".summary" + ".Ellis.h70_1" + " Does not Exist"
    Close #1
End If

If Dir$("c:\download\eande\Weekly\msgrpt." + Month_Name + ".Together" + ".Ellis.") = "" Then
    Open "c:\download\error.log" For Append As #1
    Print #1, "The file msgrpt." + Month_Name + ".Together" + ".Ellis" + " Does not Exist"
    Close #1
End If



If Dir$("c:\download\error.log") = "" Then
   'this is were i am going to email pauling telling her that something is wrong !!!!
   'does not need to process anything ********************

   'this is were i am goin gto be doing all the writing to the template through a procedure
   ' Then after this is created email it do pauline !!!
'Date for the Start of the Report
  Dim File_String As String
  Dim File_String2 As String
  Dim Date_For_Report As String
  Date_For_Report = Format(Now, "d mmm yyyy")
  'variable for using within the form
  'Tempory Variables
 
  Dim Temp_Critical As String
  Dim Temp_Major As String
  Dim Temp_Minor As String
  Dim Temp_Warning As String
  Dim Temp_Normal As String
  Dim Temp_Unknown As String

  Dim Temp_Critical2 As String
  Dim Temp_Major2 As String
  Dim Temp_Minor2 As String
  Dim Temp_Warning2 As String
  Dim Temp_Normal2 As String
  Dim Temp_Unknown2 As String



  'summary variables
  Dim File_Read As String
'--------------- summary-----------------------
  Dim Summary_Critical_h104 As String
  Dim Summary_Major_h104 As String
  Dim Summary_Minor_h104 As String
  Dim Summary_Warning_h104 As String
  Dim Summary_Normal_h104 As String
  Dim Summary_Unknown_h104 As String

  Dim Summary_Critical_h1042 As String
  Dim Summary_Major_h1042 As String
  Dim Summary_Minor_h1042 As String
  Dim Summary_Warning_h1042 As String
  Dim Summary_Normal_h1042 As String
  Dim Summary_Unknown_h1042 As String

  Dim Summary_Critical_h70 As String
  Dim Summary_Major_h70 As String
  Dim Summary_Minor_h70 As String
  Dim Summary_Warning_h70 As String
  Dim Summary_Normal_h70 As String
  Dim Summary_Unknown_h70 As String
 
  Dim Summary_Critical_h702 As String
  Dim Summary_Major_h702 As String
  Dim Summary_Minor_h702 As String
  Dim Summary_Warning_h702 As String
  Dim Summary_Normal_h702 As String
  Dim Summary_Unknown_h702 As String
 
  Dim Summary_Critical_s80 As String
  Dim Summary_Major_s80 As String
  Dim Summary_Minor_s80 As String
  Dim Summary_Warning_s80 As String
  Dim Summary_Normal_s80 As String
  Dim Summary_Unknown_s80 As String
 
  Dim Summary_Critical_s802 As String
  Dim Summary_Major_s802 As String
  Dim Summary_Minor_s802 As String
  Dim Summary_Warning_s802 As String
  Dim Summary_Normal_s802 As String
  Dim Summary_Unknown_s802 As String
'----------------------------------------------------------

  'Hardware Variables
  's80
  Dim Hardware_Critical_s80 As String
  Dim Hardware_Major_s80 As String
  Dim Hardware_Minor_s80 As String
  Dim Hardware_Warning_s80 As String
  Dim Hardware_Normal_s80 As String
  Dim Hardware_Unknown_s80 As String
 
  Dim Hardware_Critical_s802 As String
  Dim Hardware_Major_s802 As String
  Dim Hardware_Minor_s802 As String
  Dim Hardware_Warning_s802 As String
  Dim Hardware_Normal_s802 As String
  Dim Hardware_Unknown_s802 As String
 
 
  'h70
  Dim Hardware_Critical_h70 As String
  Dim Hardware_Major_h70 As String
  Dim Hardware_Minor_h70 As String
  Dim Hardware_Warning_h70 As String
  Dim Hardware_Normal_h70 As String
  Dim Hardware_Unknown_h70 As String
 
  Dim Hardware_Critical_h702 As String
  Dim Hardware_Major_h702 As String
  Dim Hardware_Minor_h702 As String
  Dim Hardware_Warning_h702 As String
  Dim Hardware_Normal_h702 As String
  Dim Hardware_Unknown_h702 As String

  'hp104
  Dim Hardware_Critical_hp104 As String
  Dim Hardware_Major_hp104 As String
  Dim Hardware_Minor_hp104 As String
  Dim Hardware_Warning_hp104 As String
  Dim Hardware_Normal_hp104 As String
  Dim Hardware_Unknown_hp104 As String
 
  Dim Hardware_Critical_hp1042 As String
  Dim Hardware_Major_hp1042 As String
  Dim Hardware_Minor_hp1042 As String
  Dim Hardware_Warning_hp1042 As String
  Dim Hardware_Normal_hp1042 As String
  Dim Hardware_Unknown_hp1042 As String

  'Baan Variables
  's80
  Dim Baan_Critical_s80 As String
  Dim Baan_Major_s80 As String
  Dim Baan_Minor_s80 As String
  Dim Baan_Warning_s80 As String
  Dim Baan_Normal_s80 As String
  Dim Baan_Unknown_s80 As String

  Dim Baan_Critical_s802 As String
  Dim Baan_Major_s802 As String
  Dim Baan_Minor_s802 As String
  Dim Baan_Warning_s802 As String
  Dim Baan_Normal_s802 As String
  Dim Baan_Unknown_s802 As String

'h70
  Dim Baan_Critical_h70 As String
  Dim Baan_Major_h70 As String
  Dim Baan_Minor_h70 As String
  Dim Baan_Warning_h70 As String
  Dim Baan_Normal_h70 As String
  Dim Baan_Unknown_h70 As String

  Dim Baan_Critical_h702 As String
  Dim Baan_Major_h702 As String
  Dim Baan_Minor_h702 As String
  Dim Baan_Warning_h702 As String
  Dim Baan_Normal_h702 As String
  Dim Baan_Unknown_h702 As String

'hp104
  Dim Baan_Critical_hp104 As String
  Dim Baan_Major_hp104 As String
  Dim Baan_Minor_hp104 As String
  Dim Baan_Warning_hp104 As String
  Dim Baan_Normal_hp104 As String
  Dim Baan_Unknown_hp104 As String

  Dim Baan_Critical_hp1042 As String
  Dim Baan_Major_hp1042 As String
  Dim Baan_Minor_hp1042 As String
  Dim Baan_Warning_hp1042 As String
  Dim Baan_Normal_hp1042 As String
  Dim Baan_Unknown_hp1042 As String


  'AIX Variables
  's80
  Dim AIX_Critical_s80 As String
  Dim AIX_Major_s80 As String
  Dim AIX_Minor_s80 As String
  Dim AIX_Warning_s80 As String
  Dim AIX_Normal_s80 As String
  Dim AIX_Unknown_s80 As String
 
  Dim AIX_Critical_s802 As String
  Dim AIX_Major_s802 As String
  Dim AIX_Minor_s802 As String
  Dim AIX_Warning_s802 As String
  Dim AIX_Normal_s802 As String
  Dim AIX_Unknown_s802 As String
   
  'h70
  Dim AIX_Critical_h70 As String
  Dim AIX_Major_h70 As String
  Dim AIX_Minor_h70 As String
  Dim AIX_Warning_h70 As String
  Dim AIX_Normal_h70 As String
  Dim AIX_Unknown_h70 As String

  Dim AIX_Critical_h702 As String
  Dim AIX_Major_h702 As String
  Dim AIX_Minor_h702 As String
  Dim AIX_Warning_h702 As String
  Dim AIX_Normal_h702 As String
  Dim AIX_Unknown_h702 As String
'hp104
 
  Dim AIX_Critical_hp104 As String
  Dim AIX_Major_hp104 As String
  Dim AIX_Minor_hp104 As String
  Dim AIX_Warning_hp104 As String
  Dim AIX_Normal_hp104 As String
  Dim AIX_Unknown_hp104 As String

  Dim AIX_Critical_hp1042 As String
  Dim AIX_Major_hp1042 As String
  Dim AIX_Minor_hp1042 As String
  Dim AIX_Warning_hp1042 As String
  Dim AIX_Normal_hp1042 As String
  Dim AIX_Unknown_hp1042 As String
 
  'informix variables
  'h70
  Dim Informix_Critical_h70 As String
  Dim Informix_Major_h70 As String
  Dim Informix_Minor_h70 As String
  Dim Informix_Warning_h70 As String
  Dim Informix_Normal_h70 As String
  Dim Informix_Unknown_h70 As String
 
  Dim Informix_Critical_h702 As String
  Dim Informix_Major_h702 As String
  Dim Informix_Minor_h702 As String
  Dim Informix_Warning_h702 As String
  Dim Informix_Normal_h702 As String
  Dim Informix_Unknown_h702 As String

  's80
  Dim Informix_Critical_s80 As String
  Dim Informix_Major_s80 As String
  Dim Informix_Minor_s80 As String
  Dim Informix_Warning_s80 As String
  Dim Informix_Normal_s80 As String
  Dim Informix_Unknown_s80 As String
 
  Dim Informix_Critical_s802 As String
  Dim Informix_Major_s802 As String
  Dim Informix_Minor_s802 As String
  Dim Informix_Warning_s802 As String
  Dim Informix_Normal_s802 As String
  Dim Informix_Unknown_s802 As String
 
'hp104
  Dim Informix_Critical_hp104 As String
  Dim Informix_Major_hp104 As String
  Dim Informix_Minor_hp104 As String
  Dim Informix_Warning_hp104 As String
  Dim Informix_Normal_hp104 As String
  Dim Informix_Unknown_hp104 As String
 
  Dim Informix_Critical_hp1042 As String
  Dim Informix_Major_hp1042 As String
  Dim Informix_Minor_hp1042 As String
  Dim Informix_Warning_hp1042 As String
  Dim Informix_Normal_hp1042 As String
  Dim Informix_Unknown_hp1042 As String
   
  Dim changes_text As String
  Dim actions_text As String

Open "c:\download\eande\Weekly\msgrpt." + Month_Name + ".Together" + ".Ellis" For Input As #1
  Do While Not EOF(1)
      Input #1, File_String, File_String2
      cnt = cnt + 1
      If cnt = 1 Then
         Temp_Critical = File_String
         Temp_Critical2 = File_String2
       Else
        If cnt = 2 Then
           Temp_Major = File_String
           Temp_Major2 = File_String2
        Else
            If cnt = 3 Then
                  Temp_Minor = File_String
                  Temp_Minor2 = File_String2
            Else
                  If cnt = 4 Then
                       Temp_Warning = File_String
                       Temp_Warning2 = File_String2
                  Else
                       If cnt = 5 Then
                           Temp_Normal = File_String
                           Temp_Normal2 = File_String2
                        Else
                          If cnt = 6 Then
                              Temp_Unknown = File_String
                              Temp_Unknown2 = File_String2
                          End If
                        End If
                   End If
            End If
          End If
     End If
  Loop
  Close #1
'Initialize Count
 cnt = 0
 
  Open "c:\download\eande\Weekly\msgrpt." + Month_Name + ".summary" + ".Ellis.s80_1" For Input As #1
  Do While Not EOF(1)
      Input #1, File_String, File_String2
      cnt = cnt + 1
      If cnt = 1 Then
         Summary_Critical_s80 = File_String
         Summary_Critical_s802 = File_String2
       Else
        If cnt = 2 Then
           Summary_Major_s80 = File_String
           Summary_Major_s802 = File_String2
        Else
            If cnt = 3 Then
                  Summary_Minor_s80 = File_String
                  Summary_Minor_s802 = File_String2
            Else
                  If cnt = 4 Then
                       Summary_Warning_s80 = File_String
                       Summary_Warning_s802 = File_String2
                  Else
                       If cnt = 5 Then
                           Summary_Normal_s80 = File_String
                           Summary_Normal_s802 = File_String2
                        Else
                          If cnt = 6 Then
                              Summary_Unknown_s80 = File_String
                              Summary_Unknown_s802 = File_String2
                          End If
                        End If
                   End If
            End If
          End If
     End If
  Loop
  Close #1
'Initialize Count
 cnt = 0
 
 Open "c:\download\eande\Weekly\msgrpt." + Month_Name + ".summary" + ".Ellis.h70_1" For Input As #1
  Do While Not EOF(1)
      Input #1, File_String, File_String2
      cnt = cnt + 1
      If cnt = 1 Then
         Summary_Critical_h70 = File_String
         Summary_Critical_h702 = File_String2
       Else
        If cnt = 2 Then
           Summary_Major_h70 = File_String
           Summary_Major_h702 = File_String2
        Else
            If cnt = 3 Then
                  Summary_Minor_h70 = File_String
                  Summary_Minor_h702 = File_String2
            Else
                  If cnt = 4 Then
                       Summary_Warning_h70 = File_String
                       Summary_Warning_h702 = File_String2
                  Else
                       If cnt = 5 Then
                           Summary_Normal_h70 = File_String
                           Summary_Normal_h702 = File_String2
                        Else
                          If cnt = 6 Then
                              Summary_Unknown_h70 = File_String
                              Summary_Unknown_h702 = File_String2
                          End If
                        End If
                   End If
            End If
          End If
     End If
  Loop
  Close #1
'Initialize Count
 cnt = 0
 
  Open "c:\download\eande\Weekly\msgrpt." + Month_Name + ".summary" + ".Ellis.hp104" For Input As #1
  Do While Not EOF(1)
      Input #1, File_String, File_String2
      cnt = cnt + 1
      If cnt = 1 Then
         Summary_Critical_h104 = File_String
         Summary_Critical_h1042 = File_String2
       Else
        If cnt = 2 Then
           Summary_Major_h104 = File_String
           Summary_Major_h1042 = File_String2
        Else
            If cnt = 3 Then
                  Summary_Minor_h104 = File_String
                  Summary_Minor_h1042 = File_String2
            Else
                  If cnt = 4 Then
                       Summary_Warning_h104 = File_String
                       Summary_Warning_h1042 = File_String2
                  Else
                       If cnt = 5 Then
                           Summary_Normal_h104 = File_String
                           Summary_Normal_h1042 = File_String2
                        Else
                          If cnt = 6 Then
                              Summary_Unknown_h104 = File_String
                              Summary_Unknown_h1042 = File_String2
                          End If
                        End If
                   End If
            End If
          End If
     End If
  Loop
  Close #1
'Initialize Count
 cnt = 0
 Open "c:\download\eande\Weekly\msgrpt." + Month_Name + ".Hardware.Ellis.s80_1" For Input As #1
  Do While Not EOF(1)
      Input #1, File_String, File_String2
     
      cnt = cnt + 1
      If cnt = 1 Then
         Hardware_Critical_s80 = File_String
         Hardware_Critical_s802 = File_String2
       Else
        If cnt = 2 Then
           Hardware_Major_s80 = File_String
           Hardware_Major_s802 = File_String2
        Else
            If cnt = 3 Then
                  Hardware_Minor_s80 = File_String
                  Hardware_Minor_s802 = File_String2
            Else
                  If cnt = 4 Then
                       Hardware_Warning_s80 = File_String
                       Hardware_Warning_s802 = File_String2
                  Else
                       If cnt = 5 Then
                           Hardware_Normal_s80 = File_String
                           Hardware_Normal_s802 = File_String2
                        Else
                          If cnt = 6 Then
                              Hardware_Unknown_s80 = File_String
                              Hardware_Unknown_s802 = File_String2
                          End If
                        End If
                   End If
            End If
          End If
     End If
  Loop
  Close #1
 
  'Initialize Count
 cnt = 0
 Open "c:\download\eande\Weekly\msgrpt." + Month_Name + ".Hardware.Ellis.h70_1" For Input As #1
  Do While Not EOF(1)
      Input #1, File_String, File_String2
      cnt = cnt + 1
      If cnt = 1 Then
         Hardware_Critical_h70 = File_String
         Hardware_Critical_h702 = File_String2
       Else
        If cnt = 2 Then
           Hardware_Major_h70 = File_String
           Hardware_Major_h702 = File_String2
        Else
            If cnt = 3 Then
                  Hardware_Minor_h70 = File_String
                  Hardware_Minor_h702 = File_String2
            Else
                  If cnt = 4 Then
                       Hardware_Warning_h70 = File_String
                       Hardware_Warning_h702 = File_String2
                  Else
                       If cnt = 5 Then
                           Hardware_Normal_h70 = File_String
                           Hardware_Normal_h702 = File_String2
                        Else
                          If cnt = 6 Then
                              Hardware_Unknown_h70 = File_String
                              Hardware_Unknown_h702 = File_String2
                          End If
                        End If
                   End If
            End If
          End If
     End If
  Loop
  Close #1
 
 'Initialize Count
 cnt = 0
 
 Open "c:\download\eande\Weekly\msgrpt." + Month_Name + ".Hardware.Ellis.hp104" For Input As #1
  Do While Not EOF(1)
      Input #1, File_String, File_String2
      cnt = cnt + 1
      If cnt = 1 Then
         Hardware_Critical_hp104 = File_String
         Hardware_Critical_hp1042 = File_String2
       Else
        If cnt = 2 Then
           Hardware_Major_hp104 = File_String
           Hardware_Major_hp1042 = File_String2
        Else
            If cnt = 3 Then
                  Hardware_Minor_hp104 = File_String
                  Hardware_Minor_hp1042 = File_String2
            Else
                  If cnt = 4 Then
                       Hardware_Warning_hp104 = File_String
                       Hardware_Warning_hp1042 = File_String2
                  Else
                       If cnt = 5 Then
                           Hardware_Normal_hp104 = File_String
                           Hardware_Normal_hp1042 = File_String2
                        Else
                          If cnt = 6 Then
                              Hardware_Unknown_hp104 = File_String
                              Hardware_Unknown_hp1042 = File_String2
                          End If
                        End If
                   End If
            End If
          End If
     End If
  Loop
  Close #1
 'Initialize Count
 cnt = 0
 
 Open "c:\download\eande\Weekly\msgrpt." + Month_Name + ".Informix.Ellis.s80_1" For Input As #1
  Do While Not EOF(1)
      Input #1, File_String, File_String2
     
      cnt = cnt + 1
      If cnt = 1 Then
         Informix_Critical_s80 = File_String
         Informix_Critical_s802 = File_String2
       Else
        If cnt = 2 Then
           Informix_Major_s80 = File_String
           Informix_Major_s802 = File_String2
        Else
            If cnt = 3 Then
                  Informix_Minor_s80 = File_String
                  Informix_Minor_s802 = File_String2
            Else
                  If cnt = 4 Then
                       Informix_Warning_s80 = File_String
                       Informix_Warning_s802 = File_String2
                  Else
                       If cnt = 5 Then
                           Informix_Normal_s80 = File_String
                           Informix_Normal_s802 = File_String2
                        Else
                          If cnt = 6 Then
                              Informix_Unknown_s80 = File_String
                              Informix_Unknown_s802 = File_String2
                          End If
                        End If
                   End If
            End If
          End If
     End If
  Loop
  Close #1
  'Initialize Count
 cnt = 0
 
 
 Open "c:\download\eande\Weekly\msgrpt." + Month_Name + ".Informix.Ellis.h70_1" For Input As #1
  Do While Not EOF(1)
      Input #1, File_String, File_String2
     
      cnt = cnt + 1
      If cnt = 1 Then
         Informix_Critical_h70 = File_String
         Informix_Critical_h702 = File_String2
       Else
        If cnt = 2 Then
           Informix_Major_h70 = File_String
           Informix_Major_h702 = File_String2
        Else
            If cnt = 3 Then
                  Informix_Minor_h70 = File_String
                  Informix_Minor_h702 = File_String2
            Else
                  If cnt = 4 Then
                       Informix_Warning_h70 = File_String
                       Informix_Warning_h702 = File_String2
                  Else
                       If cnt = 5 Then
                           Informix_Normal_h70 = File_String
                           Informix_Normal_h702 = File_String2
                        Else
                          If cnt = 6 Then
                              Informix_Unknown_h70 = File_String
                              Informix_Unknown_h702 = File_String2
                          End If
                        End If
                   End If
            End If
          End If
     End If
  Loop
  Close #1
  'Initialize Count
 cnt = 0
 
 Open "c:\download\eande\Weekly\msgrpt." + Month_Name + ".Informix.Ellis.hp104" For Input As #1
  Do While Not EOF(1)
      Input #1, File_String, File_String2
     
      cnt = cnt + 1
      If cnt = 1 Then
         Informix_Critical_hp104 = File_String
         Informix_Critical_hp1042 = File_String2
       Else
        If cnt = 2 Then
           Informix_Major_hp104 = File_String
           Informix_Major_hp1042 = File_String2
        Else
            If cnt = 3 Then
                  Informix_Minor_hp104 = File_String
                  Informix_Minor_hp1042 = File_String2
            Else
                  If cnt = 4 Then
                       Informix_Warning_hp104 = File_String
                       Informix_Warning_hp1042 = File_String2
                  Else
                       If cnt = 5 Then
                           Informix_Normal_hp104 = File_String
                           Informix_Normal_hp1042 = File_String2
                        Else
                          If cnt = 6 Then
                              Informix_Unknown_hp104 = File_String
                              Informix_Unknown_hp1042 = File_String2
                          End If
                        End If
                   End If
            End If
          End If
     End If
  Loop
  Close #1
  'Initialize Count
 cnt = 0
 
 Open "c:\download\eande\Weekly\msgrpt." + Month_Name + ".Baan.Ellis.s80_1" For Input As #1
  Do While Not EOF(1)
      Input #1, File_String, File_String2
     
      cnt = cnt + 1
      If cnt = 1 Then
         Baan_Critical_s80 = File_String
         Baan_Critical_s802 = File_String2
       Else
        If cnt = 2 Then
           Baan_Major_s80 = File_String
           Baan_Major_s802 = File_String2
        Else
            If cnt = 3 Then
                  Baan_Minor_s80 = File_String
                  Baan_Minor_s802 = File_String2
            Else
                  If cnt = 4 Then
                       Baan_Warning_s80 = File_String
                       Baan_Warning_s802 = File_String2
                  Else
                       If cnt = 5 Then
                           Baan_Normal_s80 = File_String
                           Baan_Normal_s802 = File_String2
                        Else
                          If cnt = 6 Then
                              Baan_Unknown_s80 = File_String
                              Baan_Unknown_s802 = File_String2
                          End If
                        End If
                   End If
            End If
          End If
     End If
  Loop
  Close #1
    'Initialize Count
 cnt = 0

 Open "c:\download\eande\Weekly\msgrpt." + Month_Name + ".Baan.Ellis.h70_1" For Input As #1
  Do While Not EOF(1)
      Input #1, File_String, File_String2
     
      cnt = cnt + 1
      If cnt = 1 Then
         Baan_Critical_h70 = File_String
         Baan_Critical_h702 = File_String2
       Else
        If cnt = 2 Then
           Baan_Major_h70 = File_String
           Baan_Major_h702 = File_String2
        Else
            If cnt = 3 Then
                  Baan_Minor_h70 = File_String
                  Baan_Minor_h702 = File_String2
            Else
                  If cnt = 4 Then
                       Baan_Warning_h70 = File_String
                       Baan_Warning_h702 = File_String2
                  Else
                       If cnt = 5 Then
                           Baan_Normal_h70 = File_String
                           Baan_Normal_h702 = File_String2
                        Else
                          If cnt = 6 Then
                              Baan_Unknown_h70 = File_String
                              Baan_Unknown_h702 = File_String2
                          End If
                        End If
                   End If
            End If
          End If
     End If
  Loop
  Close #1
    'Initialize Count
 cnt = 0
  Open "c:\download\eande\Weekly\msgrpt." + Month_Name + ".Baan.Ellis.hp104" For Input As #1
  Do While Not EOF(1)
      Input #1, File_String, File_String2
     
      cnt = cnt + 1
      If cnt = 1 Then
         Baan_Critical_hp104 = File_String
         Baan_Critical_hp1042 = File_String2
       Else
        If cnt = 2 Then
           Baan_Major_hp104 = File_String
           Baan_Major_hp1042 = File_String2
        Else
            If cnt = 3 Then
                  Baan_Minor_hp104 = File_String
                  Baan_Minor_hp1042 = File_String2
            Else
                  If cnt = 4 Then
                       Baan_Warning_hp104 = File_String
                       Baan_Warning_hp1042 = File_String2
                  Else
                       If cnt = 5 Then
                           Baan_Normal_hp104 = File_String
                           Baan_Normal_hp1042 = File_String2
                        Else
                          If cnt = 6 Then
                              Baan_Unknown_hp104 = File_String
                              Baan_Unknown_hp1042 = File_String2
                          End If
                        End If
                   End If
            End If
          End If
     End If
  Loop
  Close #1
    'Initialize Count
 cnt = 0
 Open "c:\download\eande\Weekly\msgrpt." + Month_Name + ".Baan.Ellis.h70_1" For Input As #1
  Do While Not EOF(1)
      Input #1, File_String, File_String2
     
      cnt = cnt + 1
      If cnt = 1 Then
         Baan_Critical_h70 = File_String
         Baan_Critical_h702 = File_String2
       Else
        If cnt = 2 Then
           Baan_Major_h70 = File_String
           Baan_Major_h702 = File_String2
        Else
            If cnt = 3 Then
                  Baan_Minor_h70 = File_String
                  Baan_Minor_h702 = File_String2
            Else
                  If cnt = 4 Then
                       Baan_Warning_h70 = File_String
                       Baan_Warning_h702 = File_String2
                  Else
                       If cnt = 5 Then
                           Baan_Normal_h70 = File_String
                           Baan_Normal_h702 = File_String2
                        Else
                          If cnt = 6 Then
                              Baan_Unknown_h70 = File_String
                              Baan_Unknown_h702 = File_String2
                          End If
                        End If
                   End If
            End If
          End If
     End If
  Loop
  Close #1
    'Initialize Count
 cnt = 0
 Open "c:\download\eande\Weekly\msgrpt." + Month_Name + ".AIX.Ellis.s80_1" For Input As #1
  Do While Not EOF(1)
      Input #1, File_String, File_String2
     
      cnt = cnt + 1
      If cnt = 1 Then
         AIX_Critical_s80 = File_String
         AIX_Critical_s802 = File_String2
       Else
        If cnt = 2 Then
           AIX_Major_s80 = File_String
           AIX_Major_s802 = File_String2
        Else
            If cnt = 3 Then
                  AIX_Minor_s80 = File_String
                  AIX_Minor_s802 = File_String2
            Else
                  If cnt = 4 Then
                       AIX_Warning_s80 = File_String
                       AIX_Warning_s802 = File_String2
                  Else
                       If cnt = 5 Then
                           AIX_Normal_s80 = File_String
                           AIX_Normal_s802 = File_String2
                        Else
                          If cnt = 6 Then
                              AIX_Unknown_s80 = File_String
                              AIX_Unknown_s802 = File_String2
                          End If
                        End If
                   End If
            End If
          End If
     End If
  Loop
  Close #1
 'initialize count
 cnt = 0
 
 
 Open "c:\download\eande\Weekly\msgrpt." + Month_Name + ".AIX.Ellis.h70_1" For Input As #1
  Do While Not EOF(1)
      Input #1, File_String, File_String2
     
      cnt = cnt + 1
      If cnt = 1 Then
         AIX_Critical_h70 = File_String
         AIX_Critical_h702 = File_String2
       Else
        If cnt = 2 Then
           AIX_Major_h70 = File_String
           AIX_Major_h702 = File_String2
        Else
            If cnt = 3 Then
                  AIX_Minor_h70 = File_String
                  AIX_Minor_h702 = File_String2
            Else
                  If cnt = 4 Then
                       AIX_Warning_h70 = File_String
                       AIX_Warning_h702 = File_String2
                  Else
                       If cnt = 5 Then
                           AIX_Normal_h70 = File_String
                           AIX_Normal_h702 = File_String2
                        Else
                          If cnt = 6 Then
                              AIX_Unknown_h70 = File_String
                              AIX_Unknown_h702 = File_String2
                          End If
                        End If
                   End If
            End If
          End If
     End If
  Loop
  Close #1
 'initialize count
 cnt = 0
 
  Open "c:\download\eande\Weekly\msgrpt." + Month_Name + ".AIX.Ellis.hp104" For Input As #1
  Do While Not EOF(1)
      Input #1, File_String, File_String2
     
      cnt = cnt + 1
      If cnt = 1 Then
         AIX_Critical_hp104 = File_String
         AIX_Critical_hp1042 = File_String2
       Else
        If cnt = 2 Then
           AIX_Major_hp104 = File_String
           AIX_Major_hp1042 = File_String2
        Else
            If cnt = 3 Then
                  AIX_Minor_hp104 = File_String
                  AIX_Minor_hp1042 = File_String2
            Else
                  If cnt = 4 Then
                       AIX_Warning_hp104 = File_String
                       AIX_Warning_hp1042 = File_String2
                  Else
                       If cnt = 5 Then
                           AIX_Normal_hp104 = File_String
                           AIX_Normal_hp1042 = File_String2
                        Else
                          If cnt = 6 Then
                              AIX_Unknown_hp104 = File_String
                              AIX_Unknown_hp1042 = File_String2
                          End If
                        End If
                   End If
            End If
          End If
     End If
  Loop
  Close #1
 'Check the changes log
   If Dir$("c:\download\+" + Month_Name + "_changes.doc") <> "" Then
         changes_text = "Document attached to email"
 
   Else
        Let changes_text = "No Changes Occured this month"
   End If
 
  'Check the actions log
   'If Dir$("c:\download\actions.log") <> "" Then
   '   Open "c:\download\actions.log" For Input As #1
    '     actions_text = Input$(LOF(1), #1)
   '   Close #1
   'Else
  '      Let actions_text = "No Actions Occured this month"
  ' End If
   
  'Create Word Document
  Dim wd As Object
  Set wd = CreateObject("word.basic")
  'wd.appshow
  wd.filenew Template:="c:\download\eandeW.dot"
  wd.setformresult "Month_Date", Date_For_Report
 
  wd.setformresult "togcritical", Temp_Critical
  wd.setformresult "togmajor", Temp_Major
  wd.setformresult "togminor", Temp_Minor
  wd.setformresult "togwarning", Temp_Warning
  wd.setformresult "tognormal", Temp_Normal
  wd.setformresult "togunknown", Temp_Unknown
 
  wd.setformresult "togcritical2", Temp_Critical2
  wd.setformresult "togmajor2", Temp_Major2
  wd.setformresult "togminor2", Temp_Minor2
  wd.setformresult "togwarning2", Temp_Warning2
  wd.setformresult "tognormal2", Temp_Normal2
  wd.setformresult "togunknown2", Temp_Unknown2
 
  wd.setformresult "Critical", Summary_Critical_s80
  wd.setformresult "Major", Summary_Major_s80
  wd.setformresult "Minor", Summary_Minor_s80
  wd.setformresult "Warning", Summary_Warning_s80
  wd.setformresult "Normal", Summary_Normal_s80
  wd.setformresult "Unknown", Summary_Unknown_s80
 
  wd.setformresult "Critical2", Summary_Critical_s802
  wd.setformresult "Major2", Summary_Major_s802
  wd.setformresult "Minor2", Summary_Minor_s802
  wd.setformresult "Warning2", Summary_Warning_s802
  wd.setformresult "Normal2", Summary_Normal_s802
  wd.setformresult "Unknown2", Summary_Unknown_s802
 
  wd.setformresult "h70Critical", Summary_Critical_h70
  wd.setformresult "h70Major", Summary_Major_h70
  wd.setformresult "h70Minor", Summary_Minor_h70
  wd.setformresult "h70Warning", Summary_Warning_h70
  wd.setformresult "h70Normal", Summary_Normal_h70
  wd.setformresult "h70Unknown", Summary_Unknown_h70
 
  wd.setformresult "h70Critical2", Summary_Critical_h702
  wd.setformresult "h70Major2", Summary_Major_h702
  wd.setformresult "h70Minor2", Summary_Minor_h702
  wd.setformresult "h70Warning2", Summary_Warning_h702
  wd.setformresult "h70Normal2", Summary_Normal_h702
  wd.setformresult "h70Unknown2", Summary_Unknown_h702
 
  wd.setformresult "hp104Critical", Summary_Critical_h104
  wd.setformresult "hp104Major", Summary_Major_h104
  wd.setformresult "hp104Minor", Summary_Minor_h104
  wd.setformresult "hp104Warning", Summary_Warning_h104
  wd.setformresult "hp104Normal", Summary_Normal_h104
  wd.setformresult "hp104Unknown", Summary_Unknown_h104
 
  wd.setformresult "hp104Critical2", Summary_Critical_h1042
  wd.setformresult "hp104Major2", Summary_Major_h1042
  wd.setformresult "hp104Minor2", Summary_Minor_h1042
  wd.setformresult "hp104Warning2", Summary_Warning_h1042
  wd.setformresult "hp104Normal2", Summary_Normal_h1042
  wd.setformresult "hp104Unknown2", Summary_Unknown_h1042
 
  wd.setformresult "baans80critical", Baan_Critical_s80
  wd.setformresult "baans80Major", Baan_Major_s80
  wd.setformresult "baans80Minor", Baan_Minor_s80
  wd.setformresult "baans80Warning", Baan_Warning_s80
  wd.setformresult "baans80Normal", Baan_Normal_s80
  wd.setformresult "baans80Unknown", Baan_Unknown_s80
   
  wd.setformresult "baans80critical2", Baan_Critical_s802
  wd.setformresult "baans80Major2", Baan_Major_s802
  wd.setformresult "baans80Minor2", Baan_Minor_s802
  wd.setformresult "baans80Warning2", Baan_Warning_s802
  wd.setformresult "baans80Normal2", Baan_Normal_s802
  wd.setformresult "baans80Unknown2", Baan_Unknown_s802
 
 
  wd.setformresult "baanh70critical", Baan_Critical_h70
  wd.setformresult "baanh70Major", Baan_Major_h70
  wd.setformresult "baanh70Minor", Baan_Minor_h70
  wd.setformresult "baanh70Warning", Baan_Warning_h70
  wd.setformresult "baanh70Normal", Baan_Normal_h70
  wd.setformresult "baanh70Unknown", Baan_Unknown_h70
 
  wd.setformresult "baanh70critical2", Baan_Critical_h702
  wd.setformresult "baanh70Major2", Baan_Major_h702
  wd.setformresult "baanh70Minor2", Baan_Minor_h702
  wd.setformresult "baanh70Warning2", Baan_Warning_h702
  wd.setformresult "baanh70Normal2", Baan_Normal_h702
  wd.setformresult "baanh70Unknown2", Baan_Unknown_h702
 
 
 
  wd.setformresult "baanhp104critical", Baan_Critical_hp104
  wd.setformresult "baanhp104Major", Baan_Major_hp104
  wd.setformresult "baanhp104Minor", Baan_Minor_hp104
  wd.setformresult "baanhp104Warning", Baan_Warning_hp104
  wd.setformresult "baanhp104Normal", Baan_Normal_hp104
  wd.setformresult "baanhp104Unknown", Baan_Unknown_hp104
 
  wd.setformresult "baanhp104critical2", Baan_Critical_hp1042
  wd.setformresult "baanhp104Major2", Baan_Major_hp1042
  wd.setformresult "baanhp104Minor2", Baan_Minor_hp1042
  wd.setformresult "baanhp104Warning2", Baan_Warning_hp1042
  wd.setformresult "baanhp104Normal2", Baan_Normal_hp1042
  wd.setformresult "baanhp104Unknown2", Baan_Unknown_hp1042
 
 
 
 wd.setformresult "Infs80critical", Informix_Critical_s80
 wd.setformresult "Infs80Major", Informix_Major_s80
 wd.setformresult "Infs80Minor", Informix_Minor_s80
 wd.setformresult "Infs80Warning", Informix_Warning_s80
 wd.setformresult "Infs80Normal", Informix_Normal_s80
 wd.setformresult "Infs80Unknown", Informix_Unknown_s80
 
  wd.setformresult "Infs80critical2", Informix_Critical_s802
  wd.setformresult "Infs80Major2", Informix_Major_s802
  wd.setformresult "Infs80Minor2", Informix_Minor_s802
  wd.setformresult "Infs80Warning2", Informix_Warning_s802
  wd.setformresult "Infs80Normal2", Informix_Normal_s802
  wd.setformresult "Infs80Unknown2", Informix_Unknown_s802
 
  wd.setformresult "Infhp104critical", Informix_Critical_hp104
  wd.setformresult "Infhp104Major", Informix_Major_hp104
  wd.setformresult "Infhp104Minor", Informix_Minor_hp104
  wd.setformresult "Infhp104Warning", Informix_Warning_hp104
  wd.setformresult "Infhp104Normal", Informix_Normal_hp104
  wd.setformresult "Infhp104Unknown", Informix_Unknown_hp104
 
  wd.setformresult "Infhp104critical2", Informix_Critical_hp1042
  wd.setformresult "Infhp104Major2", Informix_Major_hp1042
  wd.setformresult "Infhp104Minor2", Informix_Minor_hp1042
  wd.setformresult "Infhp104Warning2", Informix_Warning_hp1042
  wd.setformresult "Infhp104Normal2", Informix_Normal_hp1042
  wd.setformresult "Infhp104Unknown2", Informix_Unknown_hp1042
 
  wd.setformresult "Infh70critical", Informix_Critical_h70
  wd.setformresult "Infh70Major", Informix_Major_h70
  wd.setformresult "Infh70Minor", Informix_Minor_h70
  wd.setformresult "Infh70Warning", Informix_Warning_h70
  wd.setformresult "Infh70Normal", Informix_Normal_h70
  wd.setformresult "Infh70Unknown", Informix_Unknown_h70
 
  wd.setformresult "Infh70critical2", Informix_Critical_h702
  wd.setformresult "Infh70Major2", Informix_Major_h702
  wd.setformresult "Infh70Minor2", Informix_Minor_h702
  wd.setformresult "Infh70Warning2", Informix_Warning_h702
  wd.setformresult "Infh70Normal2", Informix_Normal_h702
  wd.setformresult "Infh70Unknown2", Informix_Unknown_h702
 
  wd.setformresult "AIXh70critical", AIX_Critical_h70
  wd.setformresult "AIXh70Major", AIX_Major_h70
  wd.setformresult "AIXh70Minor", AIX_Minor_h70
  wd.setformresult "AIXh70Warning", AIX_Warning_h70
  wd.setformresult "AIXh70Normal", AIX_Normal_h70
  wd.setformresult "AIXh70Unknown", AIX_Unknown_h70
 
  wd.setformresult "AIXh70critical2", AIX_Critical_h702
  wd.setformresult "AIXh70Major2", AIX_Major_h702
  wd.setformresult "AIXh70Minor2", AIX_Minor_h702
  wd.setformresult "AIXh70Warning2", AIX_Warning_h702
  wd.setformresult "AIXh70Normal2", AIX_Normal_h702
  wd.setformresult "AIXh70Unknown2", AIX_Unknown_h702
 
  wd.setformresult "AIXs80critical", AIX_Critical_s80
  wd.setformresult "AIXs80Major", AIX_Major_s80
  wd.setformresult "AIXs80Minor", AIX_Minor_s80
  wd.setformresult "AIXs80Warning", AIX_Warning_s80
  wd.setformresult "AIXs80Normal", AIX_Normal_s80
  wd.setformresult "AIXs80Unknown", AIX_Unknown_s80
 
  wd.setformresult "AIXs80critical2", AIX_Critical_s802
  wd.setformresult "AIXs80Major2", AIX_Major_s802
  wd.setformresult "AIXs80Minor2", AIX_Minor_s802
  wd.setformresult "AIXs80Warning2", AIX_Warning_s802
  wd.setformresult "AIXs80Normal2", AIX_Normal_s802
  wd.setformresult "AIXs80Unknown2", AIX_Unknown_s802
 
  wd.setformresult "AIXhp104critical", AIX_Critical_hp104
  wd.setformresult "AIXhp104Major", AIX_Major_hp104
  wd.setformresult "AIXhp104Minor", AIX_Minor_hp104
  wd.setformresult "AIXhp104Warning", AIX_Warning_hp104
  wd.setformresult "AIXhp104Normal", AIX_Normal_hp104
  wd.setformresult "AIXhp104Unknown", AIX_Unknown_hp104
 
  wd.setformresult "AIXhp104critical2", AIX_Critical_hp1042
  wd.setformresult "AIXhp104Major2", AIX_Major_hp1042
  wd.setformresult "AIXhp104Minor2", AIX_Minor_hp1042
  wd.setformresult "AIXhp104Warning2", AIX_Warning_hp1042
  wd.setformresult "AIXhp104Normal2", AIX_Normal_hp1042
  wd.setformresult "AIXhp104Unknown2", AIX_Unknown_hp1042
   
  wd.setformresult "hws80critical", Hardware_Critical_s80
  wd.setformresult "hws80Major", Hardware_Major_s80
  wd.setformresult "hws80Minor", Hardware_Minor_s80
  wd.setformresult "hws80Warning", Hardware_Warning_s80
  wd.setformresult "hws80Normal", Hardware_Normal_s80
  wd.setformresult "hws80Unknown", Hardware_Unknown_s80
 
  wd.setformresult "hws80critical2", Hardware_Critical_s802
  wd.setformresult "hws80Major2", Hardware_Major_s802
  wd.setformresult "hws80Minor2", Hardware_Minor_s802
  wd.setformresult "hws80Warning2", Hardware_Warning_s802
  wd.setformresult "hws80Normal2", Hardware_Normal_s802
  wd.setformresult "hws80Unknown2", Hardware_Unknown_s802
 
  wd.setformresult "hwh70critical", Hardware_Critical_h70
  wd.setformresult "hwh70Major", Hardware_Major_h70
  wd.setformresult "hwh70Minor", Hardware_Minor_h70
  wd.setformresult "hwh70Warning", Hardware_Warning_h70
  wd.setformresult "hwh70Normal", Hardware_Normal_h70
  wd.setformresult "hwh70Unknown", Hardware_Unknown_h70
 
  wd.setformresult "hwh70critical2", Hardware_Critical_h702
  wd.setformresult "hwh70Major2", Hardware_Major_h702
  wd.setformresult "hwh70Minor2", Hardware_Minor_h702
  wd.setformresult "hwh70Warning2", Hardware_Warning_h702
  wd.setformresult "hwh70Normal2", Hardware_Normal_h702
  wd.setformresult "hwh70Unknown2", Hardware_Unknown_h702
 
  wd.setformresult "hwhp104critical", Hardware_Critical_hp104
  wd.setformresult "hwhp104Major", Hardware_Major_hp104
  wd.setformresult "hwhp104Minor", Hardware_Minor_hp104
  wd.setformresult "hwhp104Warning", Hardware_Warning_hp104
  wd.setformresult "hwhp104Normal", Hardware_Normal_hp104
  wd.setformresult "hwhp104Unknown", Hardware_Unknown_hp104
 
  wd.setformresult "hwhp104critical2", Hardware_Critical_hp1042
  wd.setformresult "hwhp104Major2", Hardware_Major_hp1042
  wd.setformresult "hwhp104Minor2", Hardware_Minor_hp1042
  wd.setformresult "hwhp104Warning2", Hardware_Warning_hp1042
  wd.setformresult "hwhp104Normal2", Hardware_Normal_hp1042
  wd.setformresult "hwhp104Unknown2", Hardware_Unknown_hp1042
 
  'wd.setformresult "actionsmadethismonth", actions_text
 
  wd.filesaveas "c:\download\EllWeek.doc"
  wd.fileexit
  On errorgoto GoTo errortime
     'MAPISess1.SignOn
          MAPISess1.DownLoadMail = False
          MAPISess1.LogonUI = False
          MAPISess1.Action = SESSION_SIGNON
           MAPIMess1.SessionID = MAPISess1.SessionID
           MAPIMess1.MsgIndex = -1
           MAPIMess1.RecipType = 1
           MAPIMess1.RecipDisplayName = "pauline_ennis@clearwater-consulting.co.uk"
           MAPIMess1.AddressResolveUI = False
           MAPIMess1.ResolveName
           MAPIMess1.MsgSubject = "Ellis and Everard weekly events email"
           MAPIMess1.MsgNoteText = "The document is attached "
            Match = Dir$("c:\download\eande\weekly\*.txt", vbNormal)
            Do While Match <> ""
              With MAPIMess1
               .AttachmentIndex = MAPIMess1.AttachmentCount
               .AttachmentName = Match
               .AttachmentPathName = "c:\download\eande\weekly\" & Match
               .AttachmentPosition = (MAPIMess1.AttachmentIndex * 2) + MAPIMess1.AttachmentIndex
              End With
              Match = Dir()
            Loop
            Match = Dir$("c:\download\ellweek.doc", vbNormal)
            Do While Match <> ""
              With MAPIMess1
               .AttachmentIndex = MAPIMess1.AttachmentCount
               .AttachmentName = Match
               .AttachmentPathName = "c:\download\" & Match
               .AttachmentPosition = (MAPIMess1.AttachmentIndex * 2) + MAPIMess1.AttachmentIndex
              End With
              Let i = i + 1
              Match = Dir()
            Loop
            MAPIMess1.Send False
            MAPISess1.Action = SESSION_SIGNOFF
            MAPISess1.DownLoadMail = True
            MAPISess1.LogonUI = True
            MAPISess1.Action = SESSION_SIGNON
            MAPISess1.Action = SESSION_SIGNOFF
Else
     MAPISess1.DownLoadMail = False
     MAPISess1.LogonUI = False
     MAPISess1.Action = SESSION_SIGNON
     MAPIMess1.SessionID = MAPISess1.SessionID
     MAPISess1.DownLoadMail = False
     MAPISess1.NewSession = True
 
 
      'Send an email to pauline
       On errorgoto GoTo errortime
     'MAPISess1.SignOn
       With MAPIMess1
           .SessionID = MAPISess1.SessionID
           .MsgIndex = -1
           .RecipType = 1
           .RecipDisplayName = "pauline_ennis@clearwater-consulting.co.uk"
           .AddressResolveUI = False
           .ResolveName
           .MsgSubject = "Error with Ellis and Everard Weekly email"
           .MsgNoteText = "Any problems Give me a buzz cheers Mike"
           .AttachmentPathName = "c:\download\error.log"
           .Send False
        End With
            MAPISess1.Action = SESSION_SIGNOFF
            MAPISess1.DownLoadMail = True
            MAPISess1.LogonUI = True
            MAPISess1.Action = SESSION_SIGNON
            MAPISess1.Action = SESSION_SIGNOFF
End If
'Get rid of the old log files
If Dir$("c:\download\actions.log") <> "" Then
    Kill "c:\download\actions.log"
End If

If Dir$("c:\download\changes.log") <> "" Then
      Kill "c:\download\changes.log"
End If


hope this helps!!!!
Wow.  That is a monster.  On an unrelated note, you might want to cahnge all those nested If...End If statements with a Select Case structure, but that isn't crucial.

I don't see a declaration at all for the MAPI objects.  I'm expecting some code like this somewhere:

Dim MapiSession As Object
Dim MapiMessage As Object
Dim MapiRecipient As Object
Dim MapiAttachment As Object
Dim Recpt
Dim errObj As Long
Dim errMsg
On Error GoTo MAPITrap
        ' Create the MAPI Session.
Set MapiSession = CreateObject "Mapi.Session")

Wes
i am not declaring them anywhere !!! i have added the mapicontrollers in the custom controls!!!! do i have to declare them as well ? i thought that by putting the mapi sess and mapi mess on the form that derclared them to that program !!!!  oohhh i think i am getting it now so if i do not declare them it will stay at the same session everytime is that right ?
If you don't declare them, I'm not sure what will happen.

I would declare them in the subprocedure that uses them, not as a module-level variable.  That way you can be sure a unique object will be created and destroyed every time the procedure runs.

Wes
I am not to sure whether i am doing this right when i am declaring them !!!

here is what i am putting !!!

i have thought of two was !!!

can you declare them as
dim mapimess1 as MAPIMessage ?
dim MAPISess1 as MAPISession?

i have tryed this and it seems to find the class !!! but when i run the program it falls over on the first occurance !!!

or i have read about using
set MAPISess1 =  createobject("mapi.session")
set MAPIMess1 = MAPISess1.Outbox.Messages.Add

and do i still need to add the mapi controls to the form ?

i am new at this !!!! so that is why i am being a bit thick !!!!!

cheers for yur help

mike :^)
ASKER CERTIFIED SOLUTION
Avatar of wesleystewart
wesleystewart

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Cheers for perservering with me got it sorted in the end !!!! i ended up changing my attachment routine and it works fine now !!! cheers wez

i found a problem in vb 6 when you add a reference to the mapi32.ocx control when you try and get rid of it the dahm thing stays !!!! i am putting this here incase anyone gets stuck with this problem !!! what i had to do is go into the vbp and remove it in wordpad !!!!

cya

keep up the good work :^>
Happy to help.

Wes