Cant find VBA equivalent to this c# code -


here c# code:

 if (emailbody.contains("<center>"))            {                emailbody = emailbody.remove(0, emailbody.indexof("<center>"));                 if (emailbody.contains("</center>"))                {                    emailbody = emailbody.remove(emailbody.indexof("</center>") + 10);                }            } 

i have changed vba below:

 if instr(emailbody, "<center>") > 0  emailbody = emailbody.remove(0, **emailbody**.indexof("<center>")) ''compile error      if instr(emailbody, "</center>") > 0      emailbody = emailbody.remove(emailbody.indexof("</center>") + 10)      end if  end if 

but wont compile gives error on line stated above :compile error, invalid qualifier . suggestions?

i think want <center> element emailbody.

si = instr(emailbody, "<center>") ei = instr(emailbody, "</center>") emailbody = mid(emailbody, si, ei - si + 9) 

the following vba code equivalent of c#

if instr(emailbody, "<center>") > 0     emailbody = mid(emailbody, instr(emailbody, "<center>"))     if instr(emailbody, "</center>") > 0         emailbody = mid(emailbody, 1, instr(emailbody, "</center>") + 9)     end if end if 

Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

html - Repeat image to extend header to fill screen -

javascript - Backbone.js getting target attribute -