View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Francisco Parrilla Francisco Parrilla is offline
external usenet poster
 
Posts: 11
Default Displaying the active power point file

Copy / Paste this in a module an associate with a button in a spreadsheet:

'Para fijar la ventana
Private Declare Function ShowWindow Lib "user32" (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function PostMessage Lib "user32" Alias "PostMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Declare Function GetClassName Lib "user32" Alias "GetClassNameA" (ByVal hwnd As Long, ByVal lpClassName As String, ByVal nMaxCount As Long) As Long

Const SW_SHOWNORMAL = 1
Const WM_CLOSE = &H10
Const gcClassnameMSWord = "OpusApp"
Const gcClassnameMSExcel = "XLMAIN"
Const gcClassnameMSIExplorer = "IEFrame"
Const gcClassnameMSVBasic = "wndclass_desked_gsk"
Const gcClassnameNotePad = "Notepad"
Const gcClassnameMyVBApp = "ThunderForm"

Asign this macro a button in your spreadsheet:

Sub SetVentana()
Dim WinWnd As Long, Ret As String, RetVal As Long, lpClassName As String
'Ask for a Window title
Ret = InputBox("Enter the exact window title:" + Chr$(13) + Chr$(10) + "Note: must be an exact match")
'Search the window
WinWnd = FindWindow(vbNullString, Ret)
If WinWnd = 0 Then MsgBox "Couldn't find the window ...": Exit Sub
'Show the window
ShowWindow WinWnd, SW_SHOWNORMAL
'Create a buffer
lpClassName = Space(256)
'retrieve the class name
RetVal = GetClassName(WinWnd, lpClassName, 256)
'Show the classname
' MsgBox "Classname: " + Left$(lpClassName, RetVal)
'Post a message to the window to close itself
' PostMessage WinWnd, WM_CLOSE, 0&, 0&
End Sub

Important:

You must type in Inputbox exactly like your window application powerpoint appear in your title.

Regards

Francisco Parruilla
Sistem Operator
Monterrey NL Mexico





"Francisco Parrilla" escribió en el mensaje news:...
Hi;

Maybe you must use to API´s for locate there windows where yo have your PPT window and send a signal for maximamize window.

Regards

Francisco Parrilla

"NickHK" escribió en el mensaje ...
AppActivate ?

NickHK

"avi" wrote in message
oups.com...
Hello,

A simple and hopefully easy question. I want to place a button on an
Excel UserForm that causes the active PPT file to become the active
window

The PPt file is already open

What code should be in the button?

Thanks
Avi