VBA 不会将 http:// 附加到基于文本的文件吗?

发布于 2024-09-29 18:11:06 字数 1947 浏览 5 评论 0原文

我需要以下行在 VBA 中写入 START http://,但是,它不会将 http:// 部分写入 pgp(基于文本)文件,

这有什么技巧?

objWriter.WriteLine((TextBox5.Text) + "," + "     " + "START http://" + (TextBox6.Text)

如果需要,这是代码的其余部分:

Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    Dim FILE_NAME As String = "C:\test.pgp"

    If System.IO.File.Exists(FILE_NAME) = True Then
        Dim objWriter As New System.IO.StreamWriter(FILE_NAME, True)
        objWriter.WriteLine((TextBox2.Text) + "," + "        " + "*" + (TextBox1.Text))
        objWriter.Close()
        MsgBox("The acad.pgp file was successfully appended…")
    Else
        MsgBox("File missing reinstall or contact vendor…")
    End If
End Sub

Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
    Dim FILE_NAME As String = "C:\test.pgp"

    If System.IO.File.Exists(FILE_NAME) = True Then
        Dim objWriter As New System.IO.StreamWriter(FILE_NAME, True)
        objWriter.WriteLine((TextBox3.Text) + "," + "     " + "START " + (TextBox4.Text) + ", 1,,")
        objWriter.Close()
        MsgBox("The acad.pgp file was successfully appended…")
    Else
        MsgBox("File missing reinstall or contact vendor…")
    End If
End Sub

Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
    Dim FILE_NAME As String = "C:\test.pgp"

    If System.IO.File.Exists(FILE_NAME) = True Then
        Dim objWriter As New System.IO.StreamWriter(FILE_NAME, True)
        objWriter.WriteLine((TextBox5.Text) + "," + "     " + "START http://" + (TextBox6.Text) + ", 1,,")
        objWriter.Close()
        MsgBox("The acad.pgp file was successfully appended…")
    Else
        MsgBox("File missing reinstall or contact vendor…")
    End If
End Sub

End Class

I need the following line to write START http:// in VBA, however, it won't write the http:// part to the pgp (text based) file

whats the trick for this?

objWriter.WriteLine((TextBox5.Text) + "," + "     " + "START http://" + (TextBox6.Text)

This is the rest of the code if necessary:

Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    Dim FILE_NAME As String = "C:\test.pgp"

    If System.IO.File.Exists(FILE_NAME) = True Then
        Dim objWriter As New System.IO.StreamWriter(FILE_NAME, True)
        objWriter.WriteLine((TextBox2.Text) + "," + "        " + "*" + (TextBox1.Text))
        objWriter.Close()
        MsgBox("The acad.pgp file was successfully appended…")
    Else
        MsgBox("File missing reinstall or contact vendor…")
    End If
End Sub

Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
    Dim FILE_NAME As String = "C:\test.pgp"

    If System.IO.File.Exists(FILE_NAME) = True Then
        Dim objWriter As New System.IO.StreamWriter(FILE_NAME, True)
        objWriter.WriteLine((TextBox3.Text) + "," + "     " + "START " + (TextBox4.Text) + ", 1,,")
        objWriter.Close()
        MsgBox("The acad.pgp file was successfully appended…")
    Else
        MsgBox("File missing reinstall or contact vendor…")
    End If
End Sub

Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
    Dim FILE_NAME As String = "C:\test.pgp"

    If System.IO.File.Exists(FILE_NAME) = True Then
        Dim objWriter As New System.IO.StreamWriter(FILE_NAME, True)
        objWriter.WriteLine((TextBox5.Text) + "," + "     " + "START http://" + (TextBox6.Text) + ", 1,,")
        objWriter.Close()
        MsgBox("The acad.pgp file was successfully appended…")
    Else
        MsgBox("File missing reinstall or contact vendor…")
    End If
End Sub

End Class

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

心安伴我暖 2024-10-06 18:11:06

尝试用 & 连接相反+

Try concatening with & instead +

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文