Adding quotes to the ends of a string variable

T

Torben Laursen

Hi

I want to add a quote on each side of a string variable so I can use it as a
function argument
In the code below FileName needs to have a quote added to each end otherwise
the function is not called

Code sniff:
dim FileName, str as string
FileName = Application.GetOpenFilename("VLXE Files (*.XML), *.XML")
If FileName <> False Then
str = "=VLXE_WriteFileIntoDll(" & FileName & ")"
ActiveCell.Offset(rowOffset:=0, columnOffset:=0).Value = str
end if

Can anyone show me how to do this, thanks

Thanks Torben Laursen
 
M

mooncrawler

Torben said:
Hi

I want to add a quote on each side of a string variable so I can use it as a
function argument
In the code below FileName needs to have a quote added to each end otherwise
the function is not called

Code sniff:
dim FileName, str as string
FileName = Application.GetOpenFilename("VLXE Files (*.XML), *.XML")
If FileName <> False Then
str = "=VLXE_WriteFileIntoDll(" & FileName & ")"
ActiveCell.Offset(rowOffset:=0, columnOffset:=0).Value = str
end if

Can anyone show me how to do this, thanks

Thanks Torben Laursen

str = "=VLXE_WriteFileIntoDll( Chr(34) & FileName & Chr(34) )"

Better change 'str' into another variable name, 'cos Str() is an
existing VB keyword.
 

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