String Quotes Messing Me Up/How to Pass Variable Through a String

rdsmit1

Board Regular
Joined
Apr 19, 2010
Messages
194
This is a simplified version of what I'm attempting:

Dim InventoryName As String
Dim temp As String
temp = yesssss
InventoryName = "temp"

Print #1, " <Part Name=""" & InventoryName & """

When using the above code the word temp is passed into the InventoryName field, but what I really want it to say is yesssss. I can't figure out how to make that happen, which I believe requires getting around the usage of the quotation in line 4 of the code. When I just remove those quotes nothing gets passed to the last line of the code for the InventoryName.... head banger! please help.
 

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type
temp = "yesssss"
InventoryName= temp
 
Upvote 0
The problem is that the yessss is actually going to be plucked from a file name so I won't be able to make that change. thanks though, anymore ideas?
 
Upvote 0
Why not just set the yesssss as the file string?

Edit: is the yessss a file string, like "blah\blah\blah.xls" or something like a title, "Hours Sheet"
 
Upvote 0
This is a simplified version of what I'm attempting: Dim InventoryName As String Dim temp As String temp = yesssss InventoryName = "temp" Print #1, " <Part Name=""" & InventoryName & """When using the above code the word temp is passed into the InventoryName field, but what I really want it to say is yesssss. I can't figure out how to make that happen, which I believe requires getting around the usage of the quotation in line 4 of the code. When I just remove those quotes nothing gets passed to the last line of the code for the InventoryName.... head banger! please help.
You have too many quote marks...

Print #1, " < Part Name=" & InventoryName

Note: Remove the space that I inserted after the less than symbol (it prevents this forum's display processor from assuming it is the beginning of an HTML tag.
 
Upvote 0
The only thing I can think of is doing something like this (although I don't know why you just don't cut out the temp part of the code):

Code:
[COLOR=#333333]Dim InventoryName As String[/COLOR]
[COLOR=#333333]Dim temp As String
Dim yesssss as String

[/COLOR]yesssss = INSERTCODEHERE to pull the string you want
[COLOR=#333333]temp = yesssss[/COLOR]
[COLOR=#333333]InventoryName = temp

[/COLOR]
 
Upvote 0

Forum statistics

Threads
1,214,911
Messages
6,122,199
Members
449,072
Latest member
DW Draft

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top