Passing a string value from one module to another without quotes in VB in Excel 2010


I am trying to pass the following string to a module.


When defining the string it is requiring me to put quotes around it.  However to use the string I do not want the quotes

I have this code to build it.
 strInList = "('" & strInList & "')"  

What do I do to be able to build the string and then use it, but without the quotes.

I want to my final result to be:

This string will be used in a query
moriniaAdvanced Analytics AnalystAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Randy PooleCommented:
are you using a query string to access your query or what?
NorieVBA ExpertCommented:
If you are concatenating this string with another the " wouldn't be included.
moriniaAdvanced Analytics AnalystAuthor Commented:
I read in variables from an Excel column.  The variables were stringed together as above.  I am concatenating the variables to build the string that would be used in the query.

Proc Sql;
   Create table active_members
      as  Select  a.*  from all_Members a
where  memberid in .................... (this is where I am concatenating the string in VB)
Randy PooleCommented:
when you add the string to the query string your building the output of the string would be :
dim sql as string
dim ps as string
sql="Create table active_members "
sql=sql & "as  Select  a.*  from all_Members a "
sql=sql & "where  memberid in " & ps

Open in new window

will be
Create table active_members as  Select  a.*  from all_Members a where  memberid in ('8772282202','1356366002','0250079405')

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
NorieVBA ExpertCommented:
As I said, when you concatenate the string the double quotes will not be included.
strInList = "('8772282202','1356366002','0250079405')"

strSQL =   "Create table active_members " &  _
                  "as  Select  a.*  from all_Members a " &  _
                  "where  memberid in "  & strInList

MsgBox strSQL

Open in new window

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
VB Script

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.