+ Reply to Thread
Results 1 to 5 of 5

.position

  1. #1
    chazman
    Guest

    .position

    I am trying to use the DataLabel.Position contruct to change the position of
    a data label based on which series of chart data that it represents. Using a
    statement like DataLabel.Position = xlDataLabelAbove seems to work fine in a
    macro. When I try to use the same code within a vB function I get an error
    on the statement line.
    Any suggestions would be appreciated.

  2. #2

    Re: .position

    Just guessing, but I suspect you didn't set the parent's .HasDataLabel
    = True before you tried to set the property. This certainly applies to
    setting properties of axes, so I'd be surprised if it didn't apply to
    DataLabels too.

    Robert Smith


  3. #3
    John Mansfield
    Guest

    RE: .position

    chazman,

    Generally speaking, macros are used to perform some type of action with
    objects while functions are used to return value. If included in a function,
    a snippet of code that manipulates objects (like the data label positioning
    code) will return an error because it's attempting to change something in the
    worksheet.

    ----
    Regards,
    John Mansfield
    http://www.pdbook.com

    "chazman" wrote:

    > I am trying to use the DataLabel.Position contruct to change the position of
    > a data label based on which series of chart data that it represents. Using a
    > statement like DataLabel.Position = xlDataLabelAbove seems to work fine in a
    > macro. When I try to use the same code within a vB function I get an error
    > on the statement line.
    > Any suggestions would be appreciated.


  4. #4
    Tushar Mehta
    Guest

    Re: .position

    What error?

    --
    Regards,

    Tushar Mehta
    www.tushar-mehta.com
    Excel, PowerPoint, and VBA add-ins, tutorials
    Custom MS Office productivity solutions

    In article <[email protected]>,
    [email protected] says...
    > I am trying to use the DataLabel.Position contruct to change the position of
    > a data label based on which series of chart data that it represents. Using a
    > statement like DataLabel.Position = xlDataLabelAbove seems to work fine in a
    > macro. When I try to use the same code within a vB function I get an error
    > on the statement line.
    > Any suggestions would be appreciated.
    >


  5. #5
    Jon Peltier
    Guest

    Re: .position

    If you're not setting a reference to Excel in your VB project, VB will
    not know the value of the constant xlLabelPositionAbove, which is 0.

    My object browser does not find "xlDataLabelAbove", and recording a
    macro uses "xlLabelPositionAbove".

    - Jon
    -------
    Jon Peltier, Microsoft Excel MVP
    Peltier Technical Services
    Tutorials and Custom Solutions
    http://PeltierTech.com/
    _______

    chazman wrote:

    > I am trying to use the DataLabel.Position contruct to change the position of
    > a data label based on which series of chart data that it represents. Using a
    > statement like DataLabel.Position = xlDataLabelAbove seems to work fine in a
    > macro. When I try to use the same code within a vB function I get an error
    > on the statement line.
    > Any suggestions would be appreciated.


+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1