Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,355
Default Activating EXCEL window from PowerPoint

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
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
changing sheet in window without activating it rumi Excel Programming 0 September 13th 05 02:16 AM
Error on activating a window a open workbook Hari[_3_] Excel Programming 1 June 11th 04 12:58 AM
De-Activating the menu option, Window - Unfreeze Mario[_6_] Excel Programming 0 January 12th 04 06:57 PM
How to hide Excel window when activating a Shape object Yi[_2_] Excel Programming 4 October 8th 03 02:36 PM
How to hide Excel window when activating a Shape object Bob Kilmer Excel Programming 0 September 27th 03 03:51 PM


All times are GMT +1. The time now is 02:59 AM.

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

About Us

"It's about Microsoft Excel"