Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
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




  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 78
Default Displaying the active power point file

Hi, in my opinion, create a Powerpoint object and open the relevant PPT.
Finally call the close method on the Powerpoint object. No need to use window
handles etc...

"Francisco Parrilla" wrote:

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




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Displaying Excell like a power point presentation Displaying Excell like power point Excel Discussion (Misc queries) 3 August 20th 08 09:05 AM
Displaying the active power point file avi Excel Programming 2 March 27th 07 04:05 AM
Export excel file to power point. Manny Excel Discussion (Misc queries) 1 October 18th 06 10:56 AM
Displaying an excel file as an active desktop item? david.fredrikss Excel Discussion (Misc queries) 0 May 22nd 06 12:54 PM
how to use power point sara benson Excel Discussion (Misc queries) 2 December 12th 05 03:50 PM


All times are GMT +1. The time now is 04:08 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"