Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Excel VBA > Excel VBA
Excel VBA Discuss using VBA for Excel programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Excel VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old February 19th, 2009, 02:04 PM
Registered User
Join Date: Feb 2009
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default convert a string to a variable name


First post !

I'm referencing a cell on a worksheet that will return the string format of a User Defined Type (UDT)
However - because of the string data type this is pretty useless as I can't access the value associated with this UDT.

So - Ideally somehow I have to convert the string to a UDT format so that I can access its value as follows:

Dim nmUDT
nmUDT = Range("InputRecord").Offset(intWrite - 1, 0)

Any ideas on this ?

Much obliged

Old February 26th, 2009, 03:55 AM
Registered User
Join Date: Jan 2009
Posts: 8
Thanks: 0
Thanked 2 Times in 2 Posts

Maybe you could post some examples of input and desired output?
Old February 26th, 2009, 05:18 AM
Registered User
Join Date: Feb 2009
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts


I have dimentioned User Defined Types - for example:

I want to keep a list of all the UDT's in a spreadsheet and use them in a loop.
However - when I capture the UDT to a variable it comes through as a string and I can't see how to convert this back to a useable UDT

For example - I capture the value in the following cell to the variable.
[myVar=Sheets("InputRecord").Cells(1001, 6)]

The value in the cell is the UDT literal

myVar value is therefore a string

My question - how do I capture this in the code again as a UDT and not as a string value of the literal UDT ?

I'm beginning to think it can't be done unless I write it all into the code in the VBE

excuse my ignorance on using qoutes etc on this site !

much obliged

Similar Threads
Thread Thread Starter Forum Replies Last Post
convert to string prafullaborade XML 7 May 29th, 2008 02:59 PM
Convert a string into a variable jtrifts VBScript 4 February 21st, 2008 09:08 AM
String="" convert to DBNull bekim ASP.NET 1.0 and 1.1 Basics 1 February 28th, 2006 01:28 AM
Convert a variable John Anthony Access VBA 1 September 19th, 2003 10:58 AM
Convert variable to boolean stephanel Javascript How-To 2 June 25th, 2003 08:12 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.