Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 146
Default Anything like STRUCT in VBA?

Hello I need to return about 4 pieces of data, two of type string and two of
type integer. I could create a Class and do it that way, but I'm only going
to need to send this data back once, and within this one module, so I thought
it may be better coding practice to just use something like a STRUCT?

Is there perhaps a way to create a STRUCT data type and return that?

Thanks for any help.

Nate

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,489
Default Anything like STRUCT in VBA?

Hi,

See help on the TYPE for creating user-defined data type containing one or
more elements

Cheers
Andy
--

Andy Pope, Microsoft MVP - Excel
http://www.andypope.info
"NateBuckley" wrote in message
...
Hello I need to return about 4 pieces of data, two of type string and two
of
type integer. I could create a Class and do it that way, but I'm only
going
to need to send this data back once, and within this one module, so I
thought
it may be better coding practice to just use something like a STRUCT?

Is there perhaps a way to create a STRUCT data type and return that?

Thanks for any help.

Nate


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 146
Default Anything like STRUCT in VBA?

Thanks matey thats precisly what I was looking for.

Cheers!

"Andy Pope" wrote:

Hi,

See help on the TYPE for creating user-defined data type containing one or
more elements

Cheers
Andy
--

Andy Pope, Microsoft MVP - Excel
http://www.andypope.info
"NateBuckley" wrote in message
...
Hello I need to return about 4 pieces of data, two of type string and two
of
type integer. I could create a Class and do it that way, but I'm only
going
to need to send this data back once, and within this one module, so I
thought
it may be better coding practice to just use something like a STRUCT?

Is there perhaps a way to create a STRUCT data type and return that?

Thanks for any help.

Nate


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 638
Default Anything like STRUCT in VBA?

On Jun 2, 7:48*am, NateBuckley
wrote:
Hello I need to return about 4 pieces of data, two of type string and two of
type integer. I could create a Class and do it that way, but I'm only going
to need to send this data back once, and within this one module, so I thought
it may be better coding practice to just use something like a STRUCT?

Is there perhaps a way to create a STRUCT data type and return that?

Thanks for any help.

Nate


Private Type yourType
string1 As String
string2 As String
int1 As Integer
int2 As Integer
End Type

Sub example()
Dim yType As yourType
yType.string1 = "hello"
yType.string2 = "you"
yType.int1 = 12
yType.int2 = 34
End Sub
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 638
Default Anything like STRUCT in VBA?

On Jun 2, 8:18*am, JW wrote:
On Jun 2, 7:48*am, NateBuckley
wrote:

Hello I need to return about 4 pieces of data, two of type string and two of
type integer. I could create a Class and do it that way, but I'm only going
to need to send this data back once, and within this one module, so I thought
it may be better coding practice to just use something like a STRUCT?


Is there perhaps a way to create a STRUCT data type and return that?


Thanks for any help.


Nate


Private Type yourType
* * string1 As String
* * string2 As String
* * int1 As Integer
* * int2 As Integer
End Type

Sub example()
* * Dim yType As yourType
* * yType.string1 = "hello"
* * yType.string2 = "you"
* * yType.int1 = 12
* * yType.int2 = 34
End Sub


Welp, looks like I'm a little late. lol. Glad you got what you
needed.


  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 146
Default Anything like STRUCT in VBA?

Thanks for your reply anyways!

Cheers

"JW" wrote:

On Jun 2, 8:18 am, JW wrote:
On Jun 2, 7:48 am, NateBuckley
wrote:

Hello I need to return about 4 pieces of data, two of type string and two of
type integer. I could create a Class and do it that way, but I'm only going
to need to send this data back once, and within this one module, so I thought
it may be better coding practice to just use something like a STRUCT?


Is there perhaps a way to create a STRUCT data type and return that?


Thanks for any help.


Nate


Private Type yourType
string1 As String
string2 As String
int1 As Integer
int2 As Integer
End Type

Sub example()
Dim yType As yourType
yType.string1 = "hello"
yType.string2 = "you"
yType.int1 = 12
yType.int2 = 34
End Sub


Welp, looks like I'm a little late. lol. Glad you got what you
needed.

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
class/struct functionality in VBA? Dolemite[_8_] Excel Programming 2 January 17th 06 04:43 PM
Emulate C/C++ struct in VBA? No Name Excel Programming 8 January 8th 04 08:24 PM


All times are GMT +1. The time now is 03:16 AM.

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

About Us

"It's about Microsoft Excel"