Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

can you do this in VBA (similar to C structures) 1

Status
Not open for further replies.

shetlandbob

Programmer
Mar 9, 2004
528
GB
Hi,

Can you do this or similar in VBA (Excel 2000):
Code:
[green]// this is how I would do it in C[/green]
struct myCoords
{
  double x;
  double y;
};
struct myBox
{
  myCoords coords;
  double   xLength;
  double   yLength;
};

[green]//  more code
// so that you can have[/green]

  myBox box;
  
  box.coords.x = 0;
  box.coords.y = 0;
  box.xLength = 1;
  box.yLength = 1;

}

I'm using a class module and have some small containers that I will be using a number of times, and wondered if I can do it in a similar way as above?

Thanks,





Robert Cumming
 
Code:
Public Type MyCoords
  x As Double
  y As Double
End Type

Public Type MyBox
  Coords As MyCoords
  xLength As Double
  yLength As Double
End Type

Public Sub ABox()
Dim TheBox As MyBox

  TheBox.Coords.x = 12
  TheBox.Coords.y = 12
  TheBox.xLength = 25
  TheBox.yLength = 30

End Sub

Hope this helps.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top