vbengineer
Mechanical
- Jun 2, 2008
- 3
I am attempting to use the graphics commands/methods described in Rod Stephens "Visual Basic Graphics Programming" in VBA with Excel. I'm hoping to be able to add a graphics window that shows the relative positions and orientations of a couple of rectangles that represent two colliding vehicles. The positions and orientations are based on data listed on Sheet1 of an Excel workbook.
In an attempt to get my feet wet, I created a new module in the VB Editor and borrowed some simple code from the book that draws a rectangle using the Line command after changing the scale using the ScaleX and ScaleY commands. Excel/VBA did not like the Scale commands but did not seem to mind the Line command.
So I commented out the ScaleX/Y commands and filled numbers directly in the Line command. The code executes successfully (at least no errors) but I never get a window that opens up to display the rectangle.
'wid = ScaleX(5, vbPixels, ScaleMode)
'hgt = ScaleY(5, vbPixels, ScaleMode)
wid = 50
hgt = 50
Line (10, 10)-Step(wid, hgt), vbRed, BF
Am I missing something in the availability of the VB commands in VBA? Shouldn't I have all of VB available to me?
Maybe this is so simple that I'm just missing the boat on this? I am a novice at the graphics part of the VBA development, but have done a bit of programming in VBA .
I am running Excel 2003 on a Vista desktop.
I appreciate and help.
In an attempt to get my feet wet, I created a new module in the VB Editor and borrowed some simple code from the book that draws a rectangle using the Line command after changing the scale using the ScaleX and ScaleY commands. Excel/VBA did not like the Scale commands but did not seem to mind the Line command.
So I commented out the ScaleX/Y commands and filled numbers directly in the Line command. The code executes successfully (at least no errors) but I never get a window that opens up to display the rectangle.
'wid = ScaleX(5, vbPixels, ScaleMode)
'hgt = ScaleY(5, vbPixels, ScaleMode)
wid = 50
hgt = 50
Line (10, 10)-Step(wid, hgt), vbRed, BF
Am I missing something in the availability of the VB commands in VBA? Shouldn't I have all of VB available to me?
Maybe this is so simple that I'm just missing the boat on this? I am a novice at the graphics part of the VBA development, but have done a bit of programming in VBA .
I am running Excel 2003 on a Vista desktop.
I appreciate and help.