Modify variables in VBA
Posted on 2013-05-13
I have a bunch of variables in my code with the same name except for the last character.
Rather than have a select case statement I'd like to combine 2 variables...
e.g. I might have the following variables...
Dim PicJPG as string
Dim PicPNG as string
Dim PicBMP as string
Dim PicGIF as string
I want to assign a value to the variable like this
Pic & right(filename, 3) = thisdocument.path & filename
Select Case right(filename, 3)
PicJPG = ....
and so on... I have a lot of cases!
This is specifically for VBA