PC Review


Reply
Thread Tools Rate Thread

Activate PowerPoint from Excel

 
 
Barb Reinhardt
Guest
Posts: n/a
 
      5th Dec 2008
I've found Chip Pearson's article about activating Excel from another
application

http://www.cpearson.com/excel/ActivateExcelMain.aspx

so I'm thinking I can do this. When I look at the list of Window Class
names, I see that NetUIHWND is used for PowerPoint 2007, Word2007 and
Access2007. How does it know to find PowerPoint over Word?

Thanks,
Barb Reinhardt

 
Reply With Quote
 
 
 
 
Ronald R. Dodge, Jr.
Guest
Posts: n/a
 
      5th Dec 2008
Here's a sample of code that I have used for interacting with MS Project
within Excel VBA. Of course, this is code that is going back some time and
I have tightened down on my coding practices since that time.

Dim MSProj As MSProject.Application, NextTime As Date
Public APTLWS As Worksheet, APTLWB As Workbook, bolPrjCls As Boolean
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)

Function TestTransferData(PF As String)
Dim O As Byte ', PF As String
Application.StatusBar = "Opening Project"
O = OpenProjFile(PF)
DoEvents
If O = 0 Then
MsgBox PF & " did not open properly.(Startup)", 48
TestTransferData = 0
Exit Function
End If
Application.StatusBar = "Opening " & PF
O = FindProjWindows(PF)
If O = 0 Then
TestTransferData = 1
MSProj.FileExit (pjDoNotSave)
Exit Function
End If
TestTransferData = 1
Application.StatusBar = "Filtering and Copying " & PF
O = FilterAllTasks
DoEvents
If O = 0 Then
MsgBox PF & " did not open properly.(Proj)", 48
TestTransferData = 0
Exit Function
ElseIf O = 2 Then
TestTransferData = 1
GoTo CloseApp
End If
Application.StatusBar = "Pasting Data"
PasteResults
CloseApp:
Application.StatusBar = "Closing " & PF
MSProj.DisplayAlerts = False
MSProj.FileCloseAll (pjDoNotSave)
DoEvents
MSProj.FileExit (pjDoNotSave)
DoEvents
Set MSProj = Nothing
DoEvents
Sleep (5000)
Application.StatusBar = False
End Function
Function OpenProjFile(PF As String)
StartProject
DoEvents
On Error GoTo ErrHandle
MSProj.Alerts (False)
MSProj.DisplayAlerts = False
Application.DisplayAlerts = False
Application.StatusBar = "Opening " & PF
MSProj.FileOpen Name:=ThisWorkbook.Path & "\" & PF,
OpenPool:=pjPoolAndSharers
DoEvents
'MSProj.DisplayAlerts = True
OpenProjFile = 1
Exit Function

ErrHandle:
OpenProjFile = 0
Set MSProj = Nothing
End Function
Function FindProjWindows(PF As String)
Dim wd As Window, I As Byte, W As Byte, O As Byte
O = 0
W = MSProj.Windows.Count
If W = 1 Then
FindProjWindows = 0
Exit Function
End If
For I = 1 To W
If InStr(1, MSProj.Windows(I).Caption, "Project", 0) > 0 Then
MSProj.Windows(I).Activate
O = 1
End If
Next
If O = 0 Then
O = (ActiveWindow.Index Mod 2) + 1
MSProj.Windows(O).Activate
End If
FindProjWindows = 1
End Function
Sub InsProjNotFound()
If bolPrjCls Then
VBA.SendKeys "{TAB}{TAB}{SPACE}", False
End If
End Sub


--
Thanks,

Ronald R. Dodge, Jr.
Production Statistician
Master MOUS 2000
"Barb Reinhardt" <(E-Mail Removed)> wrote in message
newsCC183AD-460A-4B2D-91CC-(E-Mail Removed)...
> I've found Chip Pearson's article about activating Excel from another
> application
>
> http://www.cpearson.com/excel/ActivateExcelMain.aspx
>
> so I'm thinking I can do this. When I look at the list of Window Class
> names, I see that NetUIHWND is used for PowerPoint 2007, Word2007 and
> Access2007. How does it know to find PowerPoint over Word?
>
> Thanks,
> Barb Reinhardt
>



 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Reliably activate PowerPoint, do something, Activate Excel Barb Reinhardt Microsoft Excel Programming 1 4th Dec 2008 09:42 PM
VBA - Activate a PowerPoint presentation in a specific Excel windo =?Utf-8?B?RGFuIENhc2V5?= Microsoft Excel Programming 0 11th May 2006 11:22 PM
PC Upgrade! (Re-activate powerpoint) =?Utf-8?B?S2VkYXIgVHJpdmVkaQ==?= Microsoft Powerpoint 0 23rd Sep 2005 10:00 PM
help to activate powerpoint =?Utf-8?B?RVZFIEhJR0hUT1dFUg==?= Microsoft Powerpoint 1 26th Mar 2005 11:26 AM
Activate Excel after opening PowerPoint from VBA Excel Diego Microsoft Excel Programming 6 22nd Mar 2005 03:35 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:38 PM.