Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Automation Problem - powerpoint

Status
Not open for further replies.

BriceR

Programmer
Sep 20, 2001
9
0
0
AU
I wrote the following code to allow users to open a variety of
attached documents in a training app. All types work except the
powerpoint documents. Can anyone see a problem. I get an error saying
"presentations(unknown member):invalid request. The powerpoint frame
window does not exist" It is not a problem with the document or its
path as I have opened Word and Excel documents in the same path.

On Error GoTo PROC_ERR

Dim varPath
Dim objOApp As Object
varPath = Me!Path 'the document path in the attacheddocs_tbl
Select Case Right(varPath, 3)
Case "doc"

Set objOApp = CreateObject("Word.Application")
objOApp.WindowState = wdWindowStateMaximize
objOApp.Documents.Open FileName:=(varPath), ReadOnly:=False
objOApp.Visible = True

Case "xls"
Dim objExcel As Excel.Application
Set objExcel = CreateObject("excel.Application")
With objExcel
.WindowState = xlMaximized
.Workbooks.Open FileName:=(varPath), ReadOnly:=False
.Visible = True
End With

Case "ppt"

Dim objPP As PowerPoint.Application
Set objPP = CreateObject("powerpoint.Application")
With objPP
.Presentations.Open FileName:=(varPath), ReadOnly:=False
.WindowState = ppWindowMaximized
.Visible = True
End With
End Select

Exit Sub

PROC_ERR:
MsgBox "The following error occured: " & Error$
Resume Next
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top