Forum

Macro to align labe...
 
Notifications
Clear all

Macro to align label postition: different user, different result

5 Posts
2 Users
0 Reactions
62 Views
(@matthias)
Posts: 49
Trusted Member
Topic starter
 

I recorded a macro to align label positions in a graph.

Here is an example for the label position of one data point:
ActiveSheet.ChartObjects("Chart 2").Activate
ActiveChart.FullSeriesCollection(11).Points(10).DataLabel.Select
Selection.Left = 200.302

It works fine, but what could be the reason, that if a colleague runs the macro on a different computer the position of the labels is different? The macro still works fine, just the position is not where it should be, but more to the right.

 
Posted : 20/12/2017 2:56 pm
(@catalinb)
Posts: 1937
Member Admin
 

Hi Matthias,

Does that other computer have a different display resolution?

Try recording the same macro on his computer, you will see the differences. You can run a different code if the code detects another user name.

 
Posted : 21/12/2017 11:33 pm
(@matthias)
Posts: 49
Trusted Member
Topic starter
 

Hi Catalin,

so we have 4 possible resolutions to consider: 2(him and me) 2(primary and secondary screen).

Now add different colleagues and a 3rd screen for everyone ... 🙂

A solution could be to adapt the resolution before running the macro. Could that be dealt also by VBA?

Thanks,
Matthias

 
Posted : 22/12/2017 7:04 am
(@catalinb)
Posts: 1937
Member Admin
 

Hi Matthias,

You can try this code: http://www.vbaexpress.com/kb/getarticle.php?kb_id=32

Note that the icons on the desktop of that user may be messed up when you change the resolution.

 
Posted : 23/12/2017 8:38 am
(@matthias)
Posts: 49
Trusted Member
Topic starter
 

Thanks a lot, Catalin. That's a good proposal!

 
Posted : 23/12/2017 10:23 am
Share: