ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Adding quotes to the ends of a string variable (https://www.excelbanter.com/excel-programming/316464-adding-quotes-ends-string-variable.html)

Torben Laursen

Adding quotes to the ends of a string variable
 
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




---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.786 / Virus Database: 532 - Release Date: 29/10/2004



Frank Kabel

Adding quotes to the ends of a string variable
 
Hi
try:
str = "=VLXE_WriteFileIntoDll(" & """" & FileName & """" & ")"


"Torben Laursen" wrote:

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




---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.786 / Virus Database: 532 - Release Date: 29/10/2004




mooncrawler

Adding quotes to the ends of a string variable
 
Torben Laursen wrote:
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




---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.786 / Virus Database: 532 - Release Date: 29/10/2004



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

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


All times are GMT +1. The time now is 05:23 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com