Removing special characters VBA Excel -



Removing special characters VBA Excel -

i'm using vba read titles , re-create info powerpoint presentation.

my problem is, titles have special characters, image files coping on not.

the title forms part of path load jpeg image container. e.g. "p k.jpg", title called "p.k".

i want able ignore special characters in title , see space instead picks right jpg file.

is possible?

thank you!

what consider "special" characters, simple punctuation? should able utilize replace function: replace("p.k","."," ").

sub test() dim mystring string dim newstring string mystring = "p.k" newstring = replace(mystring, ".", " ") msgbox newstring end sub

if have several characters, can in custom function or simple chained series of replace functions, etc.

sub test() dim mystring string dim newstring string mystring = "!p.k" newstring = replace(replace(mystring, ".", " "), "!", " ") '## or, if easier interpret, can 2 sequential statements: 'newstring = replace(mystring, ".", " ") 'newstring = replace(newstring, "!", " ") msgbox newstring end sub

if have lot of potential special characters (non-english accented ascii example?) can custom function or iteration on array.

const specialcharacters string = "!,@,#,$,%,^,&,*,(,),{,[,],}" 'modify needed sub test() dim mystring string dim newstring string dim char variant mystring = "!p#*@)k{kdfhouef3829j" newstring = mystring each char in split(specialcharacters, ",") newstring = replace(newstring, char, " ") next end sub

excel vba excel-vba excel-2010

Comments