调用模块..时,我与E:mail的连接丢失了. [英] I am losing my connection to an E:mail when calling a module ..

查看:214
本文介绍了调用模块..时,我与E:mail的连接丢失了.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我丢失了一些程序,因此尝试从旧版本重新创建它们,我的问题是很多年前我对这些东西进行了编码,不记得现在是如何工作的,所以也许你们中的一个可以指出我朝着正确的方向...

在这里,我可以决定要使用哪种附件,以便可以决定如何处理附件...


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 ...


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




然后,我处理TXT文件,并在完成操作后删除E:Mail,但出现此错误91 ...似乎丢失了指向E:Mail的链接






I then process the TXT file and I want to delete the E:Mail it as I have finished with it, but I am getting this error 91 ... it seems to have lost the link to the E:Mail



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



任何帮助,不胜感激...

我尝试过的事情:

在网上搜索,在一个Outlook特定论坛上询问.



Any help greatly appreciated ...

What I have tried:

Searched the web, asked on an Outlook specific forum.

推荐答案

CHill60的上面的评论是答案……有时您只需要崭新的眼睛! !!
CHill60''s comment above is the answer ... sometimes you just need a fresh set of eyes !!!


这篇关于调用模块..时,我与E:mail的连接丢失了.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆