Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Macro Double quote in a string

Hi there,

I'm doing a macro in order to upload data in the database. using vb script.

As the database as specific type for each field, i need for one field to have double quote (") inside a string.

I mean that my field must be for example: "A"$"2008". That mean that if i put this into a variable, the value of the variable must be :

var = ""A"$"2008""

I'm trying to do so as in vba that mean :

var = """" & "A" & """" & "$" & """" & "2008" & """"

but this doesn't work. I have also tried using chr(34) instead of """" but still the same.

Can anybody help me please ?

Thx a lot

6 Replies
Not applicable
Author

I tried the following and it seems to be ok:

sub toto

dim myvar

myvar = chr(34) & "A" & chr(34) & "$" & chr(34) & "2008" & chr(34)
msgbox myvar


end sub

Not applicable
Author

I know that this is working but only because the msgbox assume alone that if it found 2 " it just keep one.

Look at the value of your variable, you will see that it was :

"""A""$""2008"""

That mean with to much ".

As i concatewnate this to others values, i really need to have only the good " in my variable.

Not applicable
Author

Please find attached an example. Hope this is what you want.

Not applicable
Author

Thx but it still the same!!

What i want is that the value of the variable (in the macro module -> Variable window (when debug for exemple)) is the following: ""A"$"2008"".

It means a "X" to assume that X is the string and X="A"$"2008".

In fact it was just having a variable (type string) with a " inside the string.

Not applicable
Author

Ok i found another way

Not applicable
Author

Which is ?