Solved

VBA/Excel 97: Datalabel.Position

Posted on 2001-08-16
12
1,030 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
Comment Utility
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
Comment Utility
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
Comment Utility
cri,

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

Expert Comment

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

Author Comment

by:cri
Comment Utility
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
Comment Utility
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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 13

Author Comment

by:cri
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Automate double vlookup using VBA 11 74
excel formula 6 26
Vlookup for IP 3 50
Excel 2013 Drop down help with data 3 46
How many times recently have you prepared a presentation or emailed a document to a client and you have found that they have older versions of MS Office and they can not open the file you have prepared.  Although most visitors to this site are exper…
Recently Microsoft released a brand new function called CONCAT. It's supposed to replace its predecessor CONCATENATE. But how does it work? And what's new? In this article, we take a closer look at all of this - we even included an exercise file for…
This video shows the viewer how to set up and create Footnotes in their document. Click on the References tab: Select "Insert Footnote": Type in desired text:
Learn how to create and modify your own paragraph styles in Microsoft Word. This can be helpful when wanting to make consistently referenced styles throughout a document or template.

771 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now