batch file - why is vba in outlook adding an extra line for no reason? -


i want receive email in outlook, use outlook rule run batch file in windows takes input subject , body of email (this means 2 arguments). if run line directly c:\users\me\desktop\firstplink.bat "subjectparta subjectpartb" "bodya bodyb", correct thing. there 2 arguments, in quotes. have , b there @ least 2 words in subject , in body.

my code below right thing, seems adding new line messing batch file. why added new line? an line being added after cxcvaa

sub firstplink(item outlook.mailitem)     strsubject = item.subject     msgbox strsubject     strbody = item.body     msgbox strbody     strprogramname = "c:\users\me\desktop\firstplink.bat"     strall = strsubject & " " & strbody     = """" & strprogramname & """ """ & strsubject & """ """ & strbody & """"     msgbox     call shell("""" & strprogramname & """ """ & strsubject & """ """ & strbody & """") end sub  sub testscript()     dim testmail mailitem     set testmail = application.createitem(olmailitem)     testmail.subject = "test subject"     testmail.body = "bctest bbody bb cxcvaa"     project1.module1.firstplink testmail end sub 

thanks

it appears vba overhead on outlook.mailitem appends vbcrlf item.body if not have one. evidenced code

option explicit  sub firstplink(item outlook.mailitem)     dim strsubject string, strbody string, strall string, strprogramname string     dim string     strsubject = item.subject     msgbox strsubject     debug.print asc(right(item.body, 1))     debug.print asc(right(item.body, 2))     strbody = item.body     msgbox strbody     strprogramname = "c:\users\me\desktop\firstplink.bat"     strall = strsubject & " " & strbody     = """" & strprogramname & """ """ & strsubject & """ """ & strbody & """"     msgbox     call shell("""" & strprogramname & """ """ & strsubject & """ """ & strbody & """") end sub  sub testscript()     dim testmail mailitem     set testmail = application.createitem(olmailitem)     testmail.subject = "test subject"     testmail.body = "bctest bbody bb cxcvaa"     project1.module1.firstplink testmail end sub 

the immediate window reports 10 13 on 2 debug.print's. if vbcrlf manually added (e.g. testmail.body = "bctest bbody bb cxcvaa" & vbcrlf) second vbcrlf not added.

this must have vbcrlf being expected terminate item.body , overhead adds 1 if not exist avoid crash.


Comments

Popular posts from this blog

javascript - Clear button on addentry page doesn't work -

c# - Selenium Authentication Popup preventing driver close or quit -

tensorflow when input_data MNIST_data , zlib.error: Error -3 while decompressing: invalid block type -