![]() |
|
#1
|
|||
|
|||
|
I have lost some programs so am trying to recreate them from old versions, the problem I have is that I coded this stuff many years ago and can't remember how it all works now, so perhaps one of you can point me in the right direction ...
This is where I decide what type of attachment is coming in so that I can decide what to do with it ... Code:
NoOfLeagues = NOLindex
Set Ns = GetNamespace("MAPI")
Set Inbox = Ns.GetDefaultFolder(olFolderInbox)
Set SubFolder1 = GetFolder("\\Gary Outlook 2016\Kickabout\Attachments\")
Set SubFolder2 = GetFolder("\\Gary Outlook 2016\Kickabout\Attachments\Unknown")
NoOfEMails = SubFolder1.Items.Count
If NoOfEMails = 0 Then
Exit Sub
End If
KApath = "K:\"
AtmtNo = 0
ErrorNo = 0
MyKIKtxtCount = 0
For EMailNo = NoOfEMails To 1 Step -1
Set EMail = SubFolder1.Items(EMailNo)
KIKcount = 0
TXTcount = 0
MySkip = False
For Each Atmt In EMail.Attachments
KAfiletype = Right(Atmt.FileName, 3)
Select Case KAfiletype
Case Is = "TXT"
Call Validate_TXT
Code:
Sub Validate_TXT()
Atmt.SaveAsFile KApath & "Despatch Schedule/DESPATCH SCHEDULE.TXT"
Set KA_DB = New ADODB.Connection
Set KA_RS_Leagues = New ADODB.Recordset
Set KA_Com = New ADODB.Command
KA_DB.Open "Provider=SQLOLEDB;Server=GARYSPC\SQLEXPRESS;Database=KADB; Trusted_Connection=yes"
Set KA_Com.ActiveConnection = KA_DB
MyFileNum = FreeFile()
Open KApath & "Despatch Schedule\DESPATCH SCHEDULE.TXT" For Input As #MyFileNum
MyFileNum2 = FreeFile()
Open KApath & "Despatch Schedule\DESPATCH SCHEDULE Edited.TXT" For Output As #MyFileNum2
Do While Not EOF(MyFileNum)
Input #MyFileNum, MyScheduleData
DataWanted = False
Call CheckDSdata
If DataWanted = True Then
Print #MyFileNum2, MyScheduleData
End If
Loop
Close #MyFileNum
Close #MyFileNum2
SubFolder.Items(EMailNo).Delete <<< This fails with Error Code 91, Object variable or With block variable not set.
End Sub
|
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Mail System Error - Returned Mail | jobeck1 | Outlook | 0 | 10-16-2016 08:26 AM |
| Can't Delete e-mail in outbox | EPLenson | Outlook | 2 | 05-18-2012 03:14 AM |
| Google Mail - Can't delete | silvercue | Outlook | 4 | 01-06-2012 06:10 AM |
| Can't delete range - error 5904 | expatriate | Word VBA | 1 | 06-03-2011 12:12 AM |
| Error: general mail failure. Quit excel restart mail system | MitchellDM | Outlook | 1 | 12-19-2008 02:05 AM |