开发者

Can't get VBA to write "http://"as text?

开发者 https://www.devze.com 2023-01-22 07:00 出处:网络
I wrote the code bellow and need the asociated .PGP file to have the text http:// included. the PGP file is namely read by Autocad which requers the \"http:/开发者_如何学Go/\" in its text to be able t

I wrote the code bellow and need the asociated .PGP file to have the text http:// included. the PGP file is namely read by Autocad which requers the "http:/开发者_如何学Go/" in its text to be able to launch the desierd webpage. problem is , is that VBA is Auto formating the http:// as a code entatie and not writting it to the text based PGP file.

Can any one tell me how to achive what im after?

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


Hm, I'tried your code above in VisualStudio 2010. An empty file named C:\test.pgp was appended with the following text:

textbox5,     START http://textbox6, 1,,

The text http... is right there. Sometimes, when I open the file in a viewer, this viewer automatically detects the http string and marks it as a hyperlink. But only in this viewer!

So the error seems to be somewhere else, not in the code?

0

精彩评论

暂无评论...
验证码 换一张
取 消