Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 58
Default 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
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 58
Default 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

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default 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
  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default 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
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Attaching a drawing Matt Excel Discussion (Misc queries) 2 June 29th 07 04:02 PM
Drawing toolbar. Doc Secretary Excel Worksheet Functions 5 February 23rd 07 11:46 PM
Drawing an Age Pyramid edward Charts and Charting in Excel 4 November 19th 06 06:43 PM
Drawing on Protected Sheet Robert New Users to Excel 3 June 11th 06 10:19 PM
Drawing a circle on a protected sheet Tonso Excel Discussion (Misc queries) 3 April 9th 05 09:22 PM


All times are GMT +1. The time now is 08:36 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"