Powerpoint/Word/Excel Active windows

K

kshihabi

Hello,
I am trying to allow the user to save the open document in a folder I
specify in office applications by clicking on a button added at
startup.
Therefore, I am trying to find out the current active window in
Powerpoint/Word/Excel.
I have managed to find out the active window and adding a button to it
at startup in outlook by using

ublic class ThisAddIn
Private _cbBar As Office.CommandBar
'Dim docsave As clsDoc.clsform

'dim savefile2 as cls
Private WithEvents _cbButton As Office.CommandBarButton '
CommandBarButton to show search folder
Private Sub ThisAddIn_Startup(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Startup
Dim explorer As Outlook.Explorer =
Me.Application.ActiveExplorer

' Create a new (temporary) CommandBar object.

_cbBar = explorer.CommandBars.Add("khalood",
Office.MsoBarPosition.msoBarTop, False, True)

' Create a CommandBarButton object.

_cbButton =
CType(_cbBar.Controls.Add(Office.MsoControlType.msoControlButton),
Office.CommandBarButton)

_cbButton.Caption = "khalood"

_cbButton.Style =
Microsoft.Office.Core.MsoButtonStyle.msoButtonCaption

' Make the new CommandBar visible.

_cbBar.Visible = True

explorer = Nothing
End Sub

Private Sub ThisAddIn_Shutdown(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Shutdown
_cbButton.Delete()
_cbButton = Nothing
End Sub

Private Sub _cbButton_Click(ByVal Ctrl As
Microsoft.Office.Core.CommandBarButton, ByRef CancelDefault As
Boolean) Handles _cbButton.Click

Dim docsave2 As New ChooseProject
docsave2.ShowDialog()

end sub

//chooseproject form contains

Private Sub btnsave_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnsave.Click
expl = Application.ActiveExplorer
sel = expl.Selection
end sub

-What is the similar command that should be used in Powerpoint/Word/
Excel to add a button at startup to current active explorer?

2-Is there a way to find out the file extension of the current active
window document?.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top