I am trying to call a method available in Excel VBA inside of Outlook's VBA. I need to remove spaces from a string in a clean way (for easy maintenance), so I figured it would be easy to use the "Substitute" method that is available in Excel. Since Outlook isn't able to use the command "Application.WorksheetFunction.Substitute(...)," how do I call the Substitute method?
pseudo code:
dim string1 as String, string2 as String
string1 = "hello world"
string2 = Substitute(string1, " ", "")
>> string2 = "helloworld"
CodePudding user response:
Try doing
string2 = Replace(string1, " ", "")