how to create a variable based in others

M

mtorres.f

Hi every one,

basically I need to solve this problem:

Dim c as String
Dim n as String
Dim Cojonudo as String

Public sub fff
c="Cojo"
n="nudo"

c & n = "whatever"

end sub

But this doesn´t work, any idea how can I create the variable based in
the other two.

Thanks
 
D

Dave Lett

Are you trying to get this:

Dim c as String
Dim n as String
Dim Cojonudo as String

Public sub fff
c="Cojo"
n="nudo"

Cojonudo = c & n

HTH,
Dave

Hi every one,

basically I need to solve this problem:

Dim c as String
Dim n as String
Dim Cojonudo as String

Public sub fff
c="Cojo"
n="nudo"

c & n = "whatever"

end sub

But this doesn´t work, any idea how can I create the variable based in
the other two.

Thanks
 
G

Greg Maxey

I don't think I understand exactly what you are trying to do:

Public Sub fff()
Dim c As String
Dim n As String
Dim Cojonudo As String
c = "Cojo"
n = "nudo"
Cojonudo = c & n
MsgBox Cojonudo
End Sub
 
H

Helmut Weber

Hi Greg, hi Dave,

I think the OP wants to declare a variable
at runtime, the name of which is unknown
at the programs start and should be the result
of a concatenation of the names of two other variables.

@OP: No way,
except crazy workarounds like having
a macro modify itself, like in virus programming.
I think I saw some code of that kind once.
And hardly a need to go for it.

--
Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

Win XP, Office 2003
"red.sys" & Chr$(64) & "t-online.de"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top