![]() |
Drawing on a sheet through vB
Hi,
I recorded a macro creating two lines (to represent an X over a field) ActiveSheet.Shapes.AddLine(31.5, 858.75, 607.5, 1077.75).Select Selection.ShapeRange.Flip msoFlipVertical ActiveSheet.Shapes.AddLine(30.75, 858.75, 607.5, 1077.75).Select Basicly, i want to change this to something like this: Worksheets("Invulblad").Shapes.AddLine(31.5, 858.75, 607.5, 1077.75) How can i refer to the line to create the same effect (but not using .Select and Selection.)?? Can i name my lines or objects?? PS. I drawed it through the drawing toolbox. If that matters. Cheers. Gunti |
Drawing on a sheet through vB
I'd like to simplify the question. How do i refer to a Shape to change it's
properties. I can probably figure out the properties by using the macro recorder. "Gunti" wrote: Hi, I recorded a macro creating two lines (to represent an X over a field) ActiveSheet.Shapes.AddLine(31.5, 858.75, 607.5, 1077.75).Select Selection.ShapeRange.Flip msoFlipVertical ActiveSheet.Shapes.AddLine(30.75, 858.75, 607.5, 1077.75).Select Basicly, i want to change this to something like this: Worksheets("Invulblad").Shapes.AddLine(31.5, 858.75, 607.5, 1077.75) How can i refer to the line to create the same effect (but not using .Select and Selection.)?? Can i name my lines or objects?? PS. I drawed it through the drawing toolbox. If that matters. Cheers. Gunti |
Drawing on a sheet through vB
I'd try:
Dim myShape as shape set myshape _ = Worksheets("Invulblad").Shapes.AddLine(31.5, 858.75, 607.5, 1077.75) Then work with myShape. Gunti wrote: Hi, I recorded a macro creating two lines (to represent an X over a field) ActiveSheet.Shapes.AddLine(31.5, 858.75, 607.5, 1077.75).Select Selection.ShapeRange.Flip msoFlipVertical ActiveSheet.Shapes.AddLine(30.75, 858.75, 607.5, 1077.75).Select Basicly, i want to change this to something like this: Worksheets("Invulblad").Shapes.AddLine(31.5, 858.75, 607.5, 1077.75) How can i refer to the line to create the same effect (but not using .Select and Selection.)?? Can i name my lines or objects?? PS. I drawed it through the drawing toolbox. If that matters. Cheers. Gunti -- Dave Peterson |
Drawing on a sheet through vB
By declaring the variable correctly (as a shape):
Dim myShape as Shape You'll get VBA's intellisense to pop up each time you type: myshape. (that dot is important) You'll be able to see the properties and methods. Gunti wrote: I'd like to simplify the question. How do i refer to a Shape to change it's properties. I can probably figure out the properties by using the macro recorder. "Gunti" wrote: Hi, I recorded a macro creating two lines (to represent an X over a field) ActiveSheet.Shapes.AddLine(31.5, 858.75, 607.5, 1077.75).Select Selection.ShapeRange.Flip msoFlipVertical ActiveSheet.Shapes.AddLine(30.75, 858.75, 607.5, 1077.75).Select Basicly, i want to change this to something like this: Worksheets("Invulblad").Shapes.AddLine(31.5, 858.75, 607.5, 1077.75) How can i refer to the line to create the same effect (but not using .Select and Selection.)?? Can i name my lines or objects?? PS. I drawed it through the drawing toolbox. If that matters. Cheers. Gunti -- Dave Peterson |
All times are GMT +1. The time now is 12:54 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com