PC Review


Reply
Thread Tools Rate Thread

Activating EXCEL window from PowerPoint

 
 
=?Utf-8?B?QmFyYiBSZWluaGFyZHQ=?=
Guest
Posts: n/a
 
      17th Aug 2007
I have this snippet of code that I suspect needs to be modified. I'm running
this out of PowerPoint and need to know how to get Excel to activate so that
it's not out there waiting for me to make a workbook selection. Can someone
assist?

Thanks

Sub OpenExcelWorkbook(myWB As Excel.Workbook, WorkbookIsOpen As Boolean)
Dim XLApp As Excel.Application

Set XLApp = Nothing
On Error Resume Next
Set XLApp = GetObject(, "Excel.Application")
On Error GoTo 0
If XLApp Is Nothing Then
Set XLApp = CreateObject("Excel.Application")
XLApp.visible = True
End If

' Suspect I need something here to activate Excel

With XLApp.FileDialog(msoFileDialogFilePicker)
.AllowMultiSelect = False
.Filters.Clear
.Filters.Add "Excel Files", "*.xls"
.FilterIndex = 1
.Title = "Please Select Workbook to open"
If .Show = False Then Exit Sub
sFile = .SelectedItems(1)
End With

Application.Activate

ShortName = Right(sFile, Len(sFile) - InStrRev(sFile, "\"))

On Error Resume Next
Set myWB = Nothing
Set myWB = XLApp.Workbooks(ShortName)
On Error GoTo 0

If myWB Is Nothing Then
Set myWB = XLApp.Workbooks.Open(sFile, False) 'Opening to modify
WorkbookIsOpen = False
Else
WorkbookIsOpen = True
End If

End Sub

 
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
Activating a tab within a window Zakynthos Microsoft Excel Programming 3 6th Nov 2008 10:00 AM
Activating PowerPoint application Barb Reinhardt Microsoft Powerpoint 1 23rd Sep 2008 05:51 PM
Activating PowerPoint 2003 =?Utf-8?B?QmV2aW4=?= Microsoft Powerpoint 4 7th Apr 2007 06:48 PM
How to hide Excel window when activating a Shape object Yi Microsoft Excel Programming 4 8th Oct 2003 02:36 PM
Re: How to hide Excel window when activating a Shape object Bob Kilmer Microsoft Excel Programming 1 29th Sep 2003 01:42 PM


Features
 

Advertising
 

Newsgroups
 


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