Skip to main content
Announcements
Global Transformation Awards! Applications are now open. Submit Entry
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Set scrollbar right

Hi,

I have a graph which I have ordered in ascending date order.

I have a scrollbar, but I want the graph to, by default, start with the scroll bar in the right most position (the latest date).

Presently it starts off in it's default position on the left.

I've tried the following macro:

sub OneOff
for counterVar = 71 to 72
myvar = "CH"&counterVar
set chart = ActiveDocument.GetSheetObject(myvar)
set p = chart.GetProperties
p.ChartProperties.XScrollInitRight = true
chart.SetProperties p
next
end sub

To get charts CH71 and CH72 to scroll right, but it doesn't work.

Can somebody help?

1 Solution

Accepted Solutions
Not applicable
Author

I have modified your macro and it works for me.

sub OneOff
set chart = ActiveDocument.GetSheetObject("CH71")
set chart1 = ActiveDocument.GetSheetObject("CH72")
set p = chart.GetProperties
set q = chart1.GetProperties
p.ChartProperties.XScrollInitRight = true
q.ChartProperties.XScrollInitRight = true
chart.SetProperties p
chart1.SetProperties q
end sub

I agree that the above code doesn't use a for loop.

--Santhosh

View solution in original post

5 Replies
Not applicable
Author

You dont have to write a macro for this.

Go to the properties of the chart, Click presentation.

You can see 'Reversed' icon. Enable that and it will work as you expected.

--Santhosh

Not applicable
Author

I noticed,

Nontheless I want to use the macro method since, for various reasons, the reversed button has no effect.

Not applicable
Author

I have modified your macro and it works for me.

sub OneOff
set chart = ActiveDocument.GetSheetObject("CH71")
set chart1 = ActiveDocument.GetSheetObject("CH72")
set p = chart.GetProperties
set q = chart1.GetProperties
p.ChartProperties.XScrollInitRight = true
q.ChartProperties.XScrollInitRight = true
chart.SetProperties p
chart1.SetProperties q
end sub

I agree that the above code doesn't use a for loop.

--Santhosh

Not applicable
Author

Well, that's half the problem, it doesn't use a for loop and there are about 20 of these charts.

But appart from that, even static as that is, it doesn't work. I test the function and nothing happens.

Not applicable
Author

Ok, didn't realise the effects only occur on start up.

I was expecting the test button to cause it to jump.

My mistake