C
cyb3rwolf
The following code outputs strings to a text file. For some reason it puts
quotes at the beginning and end of each line added to the text file, which
prevents me from doing what i am trying to accomplish (it is creating a
script for a different application). With the quotes in the text file, it
won't work properly. Anybody help me out? Here is my coding:
Private Sub Command4_Click()
'Define all the variables that are going to be used
Dim strInputVal As String
Dim strOutputVal As String
Dim strChar As String
Dim strMocha As String
Dim fso As Object, fsoFile As Object
'Delete the previous jda macro
Set fso = CreateObject("Scripting.FileSystemObject")
Set fsoFile = fso.GetFile("c:\mochasoft\mtn5250.9")
fsoFile.Delete
'Open the macro to write to
Open "c:\mochasoft\mtn5250.9" For Output As #1
'write the inital line to the jda macro file
Write #1, "# Script file for Mocha W32 TN5250"
strInputVal = Me.Input
For cntr = 1 To Len(strInputVal)
'read each character
strChar = Mid(strInputVal, cntr, 1)
varAsciVal = Asc(strChar)
'get the jda macro value from the table and write it to the file
Write #1, DLookup("mocha", _
"convertchar", "ASCII = " & varAsciVal & "")
Next cntr
Close #1
End Sub
quotes at the beginning and end of each line added to the text file, which
prevents me from doing what i am trying to accomplish (it is creating a
script for a different application). With the quotes in the text file, it
won't work properly. Anybody help me out? Here is my coding:
Private Sub Command4_Click()
'Define all the variables that are going to be used
Dim strInputVal As String
Dim strOutputVal As String
Dim strChar As String
Dim strMocha As String
Dim fso As Object, fsoFile As Object
'Delete the previous jda macro
Set fso = CreateObject("Scripting.FileSystemObject")
Set fsoFile = fso.GetFile("c:\mochasoft\mtn5250.9")
fsoFile.Delete
'Open the macro to write to
Open "c:\mochasoft\mtn5250.9" For Output As #1
'write the inital line to the jda macro file
Write #1, "# Script file for Mocha W32 TN5250"
strInputVal = Me.Input
For cntr = 1 To Len(strInputVal)
'read each character
strChar = Mid(strInputVal, cntr, 1)
varAsciVal = Asc(strChar)
'get the jda macro value from the table and write it to the file
Write #1, DLookup("mocha", _
"convertchar", "ASCII = " & varAsciVal & "")
Next cntr
Close #1
End Sub