Solved

VBA/Excel 97: Datalabel.Position

Posted on 2001-08-16
12
1,041 Views
Last Modified: 2010-07-27
Asking this question from a PC w/o Excel, therefore I can not post my code.

I am beefing up my Excel 97 macro which links labels/textboxes of a chart with a cell. So far so good. I have seen from the VBA Help that there is a 'xlLabelPositionBestFit' constant for the Datalabel, see also http://msdn.microsoft.com/library/default.asp?url=/library/en-us/office97/xhtml/output/F1/D3/S5A6E8.asp.

Besides the Format Label dialog not offering this option, it does not seem to work from inside VBA. Any ideas ?

Will double the points to 200 if there is a solution.

0
Comment
Question by:cri
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 8
  • 4
12 Comments
 
LVL 17

Expert Comment

by:calacuccia
ID: 6394274
cri,

This is what I get from your URL:

"Page Cannot Be Found

We apologize for any inconvenience, but we have recently redesigned our site, and the page you?re seeking has been either moved ...."

Is this the link you refer too?
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/office97/xhtml/output/F1/D3/S5A575.asp

0
 
LVL 17

Expert Comment

by:calacuccia
ID: 6394281
It must be this one
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/office97/xhtml/output/F1/D3/S5A6E8.asp

It is the point at the end of your URL, which gives bad results. Damn EE.
0
 
LVL 17

Expert Comment

by:calacuccia
ID: 6394353
cri,

What type of chart are you using? It does influence the availability of the DataLabel(s).Position possibilities.
0
Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

 
LVL 17

Expert Comment

by:calacuccia
ID: 6394371
If you have a pie chart, it is available, both in plain as VBA excel.
0
 
LVL 13

Author Comment

by:cri
ID: 6396346
calacuccia, I guess this is a combination of my mistake (the point) and the MSKB sometimes needing a refresh.

As for the charts: Most of the times I use XY charts. The strange thing I did not mention yet: I recorded a macro then changed the constant. The macro ran, but nothing seemed to happen regarding the position. In my own Sub(Datapoint is defined by a set command), I get a run time error with xlLabelPositionBestFit but not with 'Left', 'Right', 'Above', 'Below', so I think I can exclude my code.
0
 
LVL 17

Expert Comment

by:calacuccia
ID: 6396969
cri,

I have noticed the same behaviour with all chart types, except the Pie chart and the 'Donut' chart. These 2 seem the only ones that support the xlLabelPositionBestFit position for labels.
0
 
LVL 13

Author Comment

by:cri
ID: 6406025
calacuccia thank you. 100 x 4  points are already yours.

My I may shift the question a bit for the "double" or do you prefer a new question ?
 
Sub HowToAccessDialogReturnValues()
  'Is there a way to access the return values from this dialogbox ?
  'According Help the variables are:
  'x_align, y_align, orient_num, auto_text, auto_size, show_key, show_value, add_indent
  Application.Dialogs(xlDialogFormatText).Show
  ' ?? And now ?  
End Sub
0
 
LVL 17

Accepted Solution

by:
calacuccia earned 200 total points
ID: 6406620
Hi cri,

As far as I have seen up to now, you can only use those arguments to set the values prior to showing the dialog. I am looking, but have not found anything else then this possibility.

In Word, it is possible though:
http://support.microsoft.com/support/kb/articles/Q159/5/47.asp

In Excel, unfortunately, microsoft did not elaborate this part, it seems.

What you can do is play with the arguments, unfortunately, there seem to be no constants, nor named arguments.

What I have been able to do is something like this:

Sub HowToAccessDialogReturnValues()
Dim mDlg As Dialog
 'Is there a way to access the return values from this dialogbox ?
 'According Help the variables are:
 'x_align, y_align, orient_num, auto_text, auto_size, show_key, show_value, add_indent
 Set mDlg = Application.Dialogs(xlDialogFormatText)
 'Trying to use above properties prior to showing the form
 'Arg1 is x_align, Arg2 is y_align, Arg3 is orient_num
 'Arg4 is auto_text, Arg5 is auto_size, Arg6 is show_key
 'Arg7 is show_value, Arg8 is add_indent
 'There seem to be no named constants,
 'in example below, the value 2 for Arg2 will set x_align to center,
 '2 for Arg2, means y_align to center, 3 for Arg3 means orientation up to down
 ' and so on....
 myValue = mDlg.Show(Arg1:=2, Arg2:=2, Arg3:=3, Arg4:=True, Arg5:=True)
 ' ?? And now ?

End Sub

I tried to assign the result of the dialog OK button, to the variable MyValue, but this variable only returns True or False, depending if OK or Cancel has been entered...

Hopefully ... <continued>

calacuccia

0
 
LVL 13

Author Comment

by:cri
ID: 6419845
Calacuccia, I did not forget this question. Time to settle it. Do you want it now or next month ?
0
 
LVL 17

Expert Comment

by:calacuccia
ID: 6421663
cri,

If you are satisfied with the results up to now, please settle it now. Thanks for the offer for next month, but I should make my 3000 points without this.

cheers
calacuccia
0
 
LVL 13

Author Comment

by:cri
ID: 6422920
calacuccia, thank you.

BTW, did not doubt on your _ability_ to get 3000 points per month, but you seem to have cut back your participation drastically.
0
 
LVL 17

Expert Comment

by:calacuccia
ID: 6423157
ThAnks, cri.

I was not pointing towards you doubting my ability, but you doubting my activity ;-)

I might not be participating as visibly as before, but am still reading most of the questions, I'm just kind of focussing on VBA and VB questions, more than the rest.
0

Featured Post

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Using Word 2013, I was experiencing some incredible lag when typing.  Here's what worked for me....
This article descibes how to create a connection between Excel and SAP and how to move data from Excel to SAP or the other way around.
This video shows and describes the main difference between both orientations in Microsoft Word. Viewers will understand when to use each orientation and how to get the most out of them.
This video walks the viewer through the process of creating envelopes and labels, with multiple names and addresses. Navigate to the “Start Mail Merge” button in the Mailings tab: Follow the step-by-step process until asked to find the address doc…

739 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question