文本文档Outlook 2007

Van*_*ath 3 outlook vba text-files outlook-vba

我想知道是否有任何方法可以从Outlook 2007中的VBA文本文件中读取信息.

谢谢你的关注

Jac*_*cob 6

  Private Sub Command1_Click()
    'Declare variables.
    Dim fso As New FileSystemObject
    Dim ts As TextStream
    'Open file.
    Set ts = fso.OpenTextFile(Environ("windir") & "\system.ini")
    'Loop while not at the end of the file.
    Do While Not ts.AtEndOfStream
      Debug.Print ts.ReadLine
    Loop
    'Close the file.
    ts.Close
  End Sub
Run Code Online (Sandbox Code Playgroud)

来自MSDN FSO对象

然后方式更舒服Open sPath, #FileNo.您需要使用"工具 - >引用"将FSO添加到项目中,就像在MSDN中描述的那样.