Solved

VBA/Excel 97: Datalabel.Position

Posted on 2001-08-16
12
1,036 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
Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

 
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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Excel Type grid in Publisher 1 37
PowerPoint Links 7 43
Import pst files from USB thumb drive to 365 cloud 7 40
How do i remove text in between commas in Excel? 14 48
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 …
Problem: You created a new custom form in Outlook for your contacts (added fields, deleted fields, changed the layout of fields, whatever) and made it the default form for contacts. The good news is that all new contacts will utilize the new form. T…
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…
The viewer will learn how to simulate a series of sales calls dependent on a single skill level and learn how to simulate a series of sales calls dependent on two skill levels. Simulating Independent Sales Calls: Enter .75 into cell C2 – “skill leve…

809 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