簡體   English   中英

通過命令提示符運行時,我的 VB 腳本中出現錯誤 800A03EE

[英]Error 800A03EE in my VB script while running through command prompt

我在 Windows 上運行命令提示符,我在第 24 行和第 34 個字符處收到警報

代碼示例如下:

Sub CatchMe()

      Dim outobj, mailobj
      Dim strFileText
      Dim objFileToRead

      Set outobj = CreateObject("Outlook.Application")
      Set mailobj = outobj.CreateItem(0)
      strFileText = GetText("C:\Users\Yatheesh.Sathyanaray.STDC\Documents1.txt")

        With mailobj
        .To = "yatheesh.satyanarayana@stratogent.com"
        .Subject = "Testmail"
        .Body = strFileText
        .Display
      End With

      'Clear the memory
      Set outobj = Nothing
      Set mailobj = Nothing

    End Sub

    Function GetText(sFile As String) As String
       Dim nSourceFile As Integer, sText As String
       nSourceFile = FreeFile
       'Write the entire file to sText
       Open sFile For Input As #nSourceFile
       sText = Input$(LOF(1), 1)
       Close
       GetText = sText
    End Function

它可以在我的機器上使用您提供的代碼。 我已經在 Excel 文件中對其進行了測試,並將您的代碼復制如下:

在此處輸入圖片說明

但是,我注意到您使用了一個名為“FreeFile”的屬性,但似乎沒有使用。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM