Link to home
Start Free TrialLog in
Avatar of morinia
moriniaFlag for United States of America

asked on

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

Experts,

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

"('8772282202','1356366002','0250079405')"

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:
('8772282202','1356366002','0250079405')

This string will be used in a query
Avatar of Randy Poole
Randy Poole
Flag of United States of America image

are you using a query string to access your query or what?
Avatar of Norie
Norie

If you are concatenating this string with another the " wouldn't be included.
Avatar of morinia

ASKER

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.

ie.
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)
ASKER CERTIFIED SOLUTION
Avatar of Randy Poole
Randy Poole
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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