I have a project that I would like to do to help me become more familiar with classes and class objects, a difficult subject for me to understand. This project is part of a larger project that I plan to work on whenver I get time, but I would really appreciate helpful input.
Part I is to create some kind of an object, which I am attempting to do below. I have drawn something in Excel and I now want to make that into a custom object I can use. For now it does not need to be a persistant object, but just something to work with while excel is running. The object I drew has the shape that I want, and it has two places to enter some text.
How can I create a class that will construct the object below? For now the object would have two properties, class.object.text1=sometext and class.object.text2=someothertext
Sub aDrawList()
'Below are the parameters of a shape object to determine its position and size
'Left Required Single. The position, measured in points, of the left edge of the AutoShape.
'Top Required Single. The position, measured in points, of the top edge of the AutoShape.
'Width Required Single. The width, measured in points, of the AutoShape.
'Height Required Single. The height, measured in points, of the AutoShape.
Dim wks As Worksheet
Dim aLeft As Single
Dim aTop As Single
Dim aWidth As Single
Dim aHeight As Single
Dim Shp1 As Shape
Dim Shp2 As Shape
Dim Shp3 As Shape
Dim Shp4 As Shape
aLeft = 250
aTop = 130
aWidth = 100
aHeight = 60
Set wks = ActiveSheet
Set Shp1 = wks.Shapes.AddShape(msoShapeRectangle, aLeft, aTop, 100, 60)
Shp1.Fill.Visible = msoFalse
Set Shp2 = wks.Shapes.AddTextbox(msoTextOrientationHorizontal, aLeft + 10, aTop + 10, 50, 15)
Set Shp3 = wks.Shapes.AddTextbox(msoTextOrientationHorizontal, aLeft + 10, aTop + 30, 50, 15)
Set Shp4 = wks.Shapes.AddShape(msoShapeRectangle, aLeft + aWidth, aTop, 50, 60)
Shp4.Fill.Visible = msoFalse
End Sub
Display More