Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 125
Default How do you include a quotation as part of a string ??

I am trying to run this line of code which obviously doesn't work.

MyString = " " " + "Hello" + " " "
debug.print MyString

what I am trying to end up with is

"Hello" as my string QUOTES INCLUDED as part of the string.
however every time I try to use them as part of a string VBA thinks that Im
using them as a qualifer.

Can anyone help me out with this one ?

Thanks, Dan Thompson
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,440
Default How do you include a quotation as part of a string ??

For a quote between quotes, use two quotes, like in
?" "" " + "Hello" + " "" "

--
Kind regards,

Niek Otten
Microsoft MVP - Excel

"Dan Thompson" wrote in message ...
|I am trying to run this line of code which obviously doesn't work.
|
| MyString = " " " + "Hello" + " " "
| debug.print MyString
|
| what I am trying to end up with is
|
| "Hello" as my string QUOTES INCLUDED as part of the string.
| however every time I try to use them as part of a string VBA thinks that Im
| using them as a qualifer.
|
| Can anyone help me out with this one ?
|
| Thanks, Dan Thompson


  #3   Report Post  
Posted to microsoft.public.excel.programming
jk jk is offline
external usenet poster
 
Posts: 109
Default How do you include a quotation as part of a string ??

Dan,

You can also create a variable to equal a double quote. For example,

str_dblquote = chr(34)

where chr(34) is a double quote.

then try

str_dblquote + "Hello" + str_dblquote

which will print "Hello"

Good luck!

"Niek Otten" wrote:

For a quote between quotes, use two quotes, like in
?" "" " + "Hello" + " "" "

--
Kind regards,

Niek Otten
Microsoft MVP - Excel

"Dan Thompson" wrote in message ...
|I am trying to run this line of code which obviously doesn't work.
|
| MyString = " " " + "Hello" + " " "
| debug.print MyString
|
| what I am trying to end up with is
|
| "Hello" as my string QUOTES INCLUDED as part of the string.
| however every time I try to use them as part of a string VBA thinks that Im
| using them as a qualifer.
|
| Can anyone help me out with this one ?
|
| Thanks, Dan Thompson



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Search/Match/Find ANY part of string to ANY part of Cell Value TWhizTom Excel Worksheet Functions 0 July 21st 08 08:16 PM
How do I include part of a cell in text (string?) in another cell? Chris Mitchell Excel Worksheet Functions 2 June 25th 07 10:08 AM
how to use (double) quotation mark as string in codes? ViestaWu Excel Programming 3 July 31st 06 08:47 AM
Passing string arguments that have quotation marks in them Caro-Kann Defence[_2_] Excel Programming 2 April 21st 05 03:26 PM
How to include a double quotation character in a string? Georgee Excel Programming 2 August 17th 04 06:41 AM


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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"