C
caten
I need to make sure that when I send the outline to Word, the outline is
fully expanded. I created a macro that will:
1. Change to the Outline view
2. Click Expand All
3. Send the outline to Word
4. Return to the original view
When I run this macro, it works the first time, but not the second (and the
third, but not the fourth, etc.) Evidently both the Collapse All and Expand
All buttons actually toggle between fully expanded and fully collapsed. So
this will not work.
I can't find a way to check the expanded/collapsed state of the outline so
that I can Expand All conditionally.
I have noticed that if I select all slides in the outline view (by clicking
Ctrl+A), right-click, and then click Expand, the outline is fully expanded
regardless of its initial state. So this is the command I want to invoke in
my macro.
Is there a way to access controls in a shortcut menu using VBA?
I am using PowerPoint 2002 and targeting PowerPoint 2002, 2003 (and
eventually 2007) users.
Here is what I have so far:
Sub SendOutlineToWord()
Dim strOrigViewType As String 'Original view type
strOrigViewType = ActiveWindow.ViewType
'Change to Outline view
ActiveWindow.ViewType = ppViewOutline
'Click Expand All (expand the outline)
CommandBars.FindControl(Id:=706).Execute
'Click File > Send To > Microsoft Word
CommandBars.FindControl(Id:=30002).Execute
CommandBars.FindControl(Id:=30095).Execute
CommandBars.FindControl(Id:=684).Execute
'Click Outline only and then press Enter
SendKeys "%O{TAB}{ENTER}", True
MsgBox "Outline sent to Microsoft Word."
'Return to original view
ActiveWindow.ViewType = strOrigViewType
End Sub
fully expanded. I created a macro that will:
1. Change to the Outline view
2. Click Expand All
3. Send the outline to Word
4. Return to the original view
When I run this macro, it works the first time, but not the second (and the
third, but not the fourth, etc.) Evidently both the Collapse All and Expand
All buttons actually toggle between fully expanded and fully collapsed. So
this will not work.
I can't find a way to check the expanded/collapsed state of the outline so
that I can Expand All conditionally.
I have noticed that if I select all slides in the outline view (by clicking
Ctrl+A), right-click, and then click Expand, the outline is fully expanded
regardless of its initial state. So this is the command I want to invoke in
my macro.
Is there a way to access controls in a shortcut menu using VBA?
I am using PowerPoint 2002 and targeting PowerPoint 2002, 2003 (and
eventually 2007) users.
Here is what I have so far:
Sub SendOutlineToWord()
Dim strOrigViewType As String 'Original view type
strOrigViewType = ActiveWindow.ViewType
'Change to Outline view
ActiveWindow.ViewType = ppViewOutline
'Click Expand All (expand the outline)
CommandBars.FindControl(Id:=706).Execute
'Click File > Send To > Microsoft Word
CommandBars.FindControl(Id:=30002).Execute
CommandBars.FindControl(Id:=30095).Execute
CommandBars.FindControl(Id:=684).Execute
'Click Outline only and then press Enter
SendKeys "%O{TAB}{ENTER}", True
MsgBox "Outline sent to Microsoft Word."
'Return to original view
ActiveWindow.ViewType = strOrigViewType
End Sub