Solved

VBA/Excel 97: Datalabel.Position

Posted on 2001-08-16
12
1,040 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
  • 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
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Introduction Perhaps more familiar to developers who primarily use VBScript than to developers who tend to work only with Microsoft Office and Visual Basic for Applications (VBA), the Dictionary is a powerful and versatile class, and is useful …
No matter the version of Windows you are using, you may have some problems with Windows Search running too slow or possibly not running at all. Before jumping into how you can solve this issue, just know there are many other viable alternative deskt…
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

821 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