Subrouines and graphics in VBA
I'm using VBA (Visual Basic 6.3) in Excel 2002.
Can I use VBA to write a program that is made up from a series of subroutines, or the VBA equivalent? I remember using CALL in FORTRAN years ago, but what is the corresponding VBA syntax? Also, can VBA produce simple graphics (this could be a little difficult to explain). For example as an output from a VBA program a simple diagram is produced, such as lines, 2-D planes and cylinders. I'm not sure if VBA has any graphics abilities. Thanks. |
Subrouines and graphics in VBA
Sub Test1()
Msgbox "In Test1" Test2 Msgbox "Back in Test1" End Sub Sub Test2() Msgbox "In Test2" End Sub You can use shapes for simple graphics - see the drawing toolbar. Draw some shapes while recording a macro to get some idea of what you code might look like. -- Tim Williams Palo Alto, CA "stuart" wrote in message ... I'm using VBA (Visual Basic 6.3) in Excel 2002. Can I use VBA to write a program that is made up from a series of subroutines, or the VBA equivalent? I remember using CALL in FORTRAN years ago, but what is the corresponding VBA syntax? Also, can VBA produce simple graphics (this could be a little difficult to explain). For example as an output from a VBA program a simple diagram is produced, such as lines, 2-D planes and cylinders. I'm not sure if VBA has any graphics abilities. Thanks. |
Subrouines and graphics in VBA
VBA can pretty much issue all the command you can do manually. If you turn
on the macro recorder, then create your chart manually, then turn off the macro recorder, it will give you a good start on the code you need to build a chart. (delete the chart and run the code). You call a subroutine by using call Call macro2() or just put in Macro2 Sub Main() macro1 macro2 "hello Bob" macro2 "How are you" End sub Sub Macro1() msgbox "in macro1" end sub Sub Macro2(a as String) msgbox "in macro2, " & a End Sub http://msdn.microsoft.com/office/und...d/default.aspx http://www.mvps.org/dmcritchie/excel/getstarted.htm http://www.mvps.org/dmcritchie/excel....htm#tutorials links to VBA tutorials follow links to general Excel tutorials -- Regards, Tom Ogilvy "stuart" wrote: I'm using VBA (Visual Basic 6.3) in Excel 2002. Can I use VBA to write a program that is made up from a series of subroutines, or the VBA equivalent? I remember using CALL in FORTRAN years ago, but what is the corresponding VBA syntax? Also, can VBA produce simple graphics (this could be a little difficult to explain). For example as an output from a VBA program a simple diagram is produced, such as lines, 2-D planes and cylinders. I'm not sure if VBA has any graphics abilities. Thanks. |
Subrouines and graphics in VBA
Make the drawing toolbar visible under View=Toolbars
then look at the autoshapes and construct you diagram. After you have it down, turn on the macro recorder and do it again to see how the code works. -- Regards, Tom Ogilvy "Tom Ogilvy" wrote: VBA can pretty much issue all the command you can do manually. If you turn on the macro recorder, then create your chart manually, then turn off the macro recorder, it will give you a good start on the code you need to build a chart. (delete the chart and run the code). You call a subroutine by using call Call macro2() or just put in Macro2 Sub Main() macro1 macro2 "hello Bob" macro2 "How are you" End sub Sub Macro1() msgbox "in macro1" end sub Sub Macro2(a as String) msgbox "in macro2, " & a End Sub http://msdn.microsoft.com/office/und...d/default.aspx http://www.mvps.org/dmcritchie/excel/getstarted.htm http://www.mvps.org/dmcritchie/excel....htm#tutorials links to VBA tutorials follow links to general Excel tutorials -- Regards, Tom Ogilvy "stuart" wrote: I'm using VBA (Visual Basic 6.3) in Excel 2002. Can I use VBA to write a program that is made up from a series of subroutines, or the VBA equivalent? I remember using CALL in FORTRAN years ago, but what is the corresponding VBA syntax? Also, can VBA produce simple graphics (this could be a little difficult to explain). For example as an output from a VBA program a simple diagram is produced, such as lines, 2-D planes and cylinders. I'm not sure if VBA has any graphics abilities. Thanks. |
All times are GMT +1. The time now is 03:33 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com