-
In attempting to open a PowerPoint presentation via VB, the following run-time error occurs: -2147297010(8003001e) - a disk error occurred during a read operation.
Any help is appreciated - Thanks.
Here's a snippet of the code:
It works fine on the machine it was created on. But no others.
__________________________________________________________
Public Sub cmdCommand3_Click
Dim sTopic As String
Dim sFile As String
Dim sParams As Variant
Dim sDirectory As Variant
sTopic = "Open"
sFile = "powerpnt.exe"
sParams = "112-2pj.ppt"
sDirectory = 0&
Call RunShellExecute(sTopic, sFile, sParams, sDirectory, SW_SHOWNORMAL)
End Sub
__________________________________________________________
Public Sub RunShellExecute(sTopic As String, sFile As Variant, _
sParams As Variant, sDirectory As Variant, _
nShowCmd As Long)
Dim hWndDesk As Long
Dim success As Long
Const SE_ERR_NOASSOC = &H31
hWndDesk = GetDesktopWindow()
success = ShellExecute(hWndDesk, sTopic, sFile, sParams, sDirectory, nShowCmd)
'If success = SE_ERR_NOASSOC Then
' Call Shell("rundll32.exe shell32.dll,OpenAs_RunDLL " & 'sFile, vbNormalFocus)
'End If
End Sub
-
There is an easier way to do this.
On projects menu click References. From the resulting dialog box, select Microsoft PowerPoint 9.0 Object Library. Then use the following code.
Dim Pwrpnt As New PowerPoint.Application
Dim Ppt As PowerPoint.Presentation
Sub OpenSlideShow(Fle as String)
Pwrpnt.Visible = True
Set Ppt = Pwrpnt.Presentations.Open(Fle)
End Sub
Sub Test()
OpenSlideShow "C:\My Documents\My Presentation.ppt"
End Sub