NikhilS / vb2js

Automatically exported from code.google.com/p/vb2js
2 stars 3 forks source link

"vbCrLf" is not being converted to \r\n #8

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
VBA code:
msgbox "Hi" & vbcrlf & "midi25"
codeLines = vbCrLf & vbCrLf & "Sub showAmessage()" & vbCrLf & _
      "    Msgbox ""This is a macro created by a macro""" & vbCrLf & _
      "End Sub"

Converted code by VBA --- > js Converter:
msgbox("Hi" + vbcrlf + "midi25");
codeLines = vbCrLf + vbCrLf + "Sub showAmessage()" + vbCrLf + "Msgbox \"This is 
a macro 
created by a macro\"" + vbCrLf + "End Sub";

Actual converted code should be:
alert("Hi" + '\r\n' + "midi25")
codeLines = '\r\n\r\n' + "Sub showAmessage()" + '\r\n' +  "alert(""This is a 
macro created by a 
macro""" + '\r\n' +  "}" + '\r\n\r\n');

Observation:
 1. "msgbox" is not being converted to "alert"
 2. "vbcrlf " is not being converted to "\r\n"

Note:vbcrlf represents a carriage return line feed.
In java script  these are represented as:
\n      new line
\r      carriage return

VBA constant --------- javascript conversion
*********************************************
vbCrLf                  '\r\n'
vbCr                            '\r'
vbLf                            '\n'
vbTab                   '\t'

Original issue reported on code.google.com by nikhilsi...@google.com on 16 May 2010 at 6:09