List Box Showing Apostrophes (1 Viewer)

Tanner65

Registered User.
Local time
Today, 17:28
Joined
Aug 31, 2007
Messages
66
I'm wanting to populate a list box with phrases and in those phrases some of the words will have an apostrophe around them to denote what is the value that needs to be changed. IE. " 'Tanner65' is a terrible worker." But when I use the same line in the list box it only shows Tanner65 with no apostrophe. The row source does contain everything I've added, including the apostrophes.

List box row source type is set to Value List and I'm using AddItem method for each new item. Should I be going a different route? I've thought of text box, but the text box needs focus constantly in order to show the scroll bar. Plus if the user is going to copy anything from the box, I want the entire message to be pasted, not just whatever they half ass copied. (Hope that makes sense).

I've also tried doing " ' 'Tanner65' is a terrible worker." But this results in nothing being added to the list box.
 

missinglinq

AWF VIP
Local time
Today, 18:28
Joined
Jun 20, 2003
Messages
6,423
Double-Quote Single-Quote Tanner65 Single-Quote Double-Quote

"'Tanner65'"
 

Tanner65

Registered User.
Local time
Today, 17:28
Joined
Aug 31, 2007
Messages
66
Double-Quote Single-Quote Tanner65 Single-Quote Double-Quote

"'Tanner65'"
Well, that's populating the Tanner65, but not the "is a terrible worker." Although it is still listed in the rowsource. It's like it only sees the area between the apostrophe.
After adding it twice, the list box shows "Tanner65" twice And rowsource is 'Tanner65' is a terrible worker.;'Tanner65' is a terrible worker.

I'm so out of ideas.
 

Tanner65

Registered User.
Local time
Today, 17:28
Joined
Aug 31, 2007
Messages
66
I actually just figured it out.

I have to do the following to have it show the apostrophed word.
Code:
Me.ListBox.AddItem """'Tanner65' is a terrible worker."""
That's triple quote (") on both sides of the line to add.

If I set the rowsource directly it'll be:
Code:
 ME.ListBox.RowSource="""'Tanner65' is a terrible worker."";""'Tanner65' is a terrible worker."""
But when I print the rowsource it prints:
Code:
 debug.Print Me.ListBox.RowSource
"'Tanner65' is a terrible worker";"'Tanner65' is a terrible worker"
Thanks for the help missinglinq, you led me in the right direction!

Note: All of the code was pulled from the immediate window.
 

Users who are viewing this thread

Top Bottom