I have a split screen form where ai can view a PDF or audio/video file on one side and enter information about it on the other side.
I need to be able to view native files in this form as well (Word, Excel, PPT, txt, pics etc).
I have tried the EDraw Office Viewer activeX component and cannot get it to work. By the suggestion of another board, I have tried unbound frames to no avail.
Here's the code (with EDraw) so far...
Code:
Private Sub Form_Current()
Dim returnVal As Integer
Dim fileExt As String
If Me.RecordsetClone.RecordCount < 1 Then
MsgBox ("There are no records in the date range selected.")
Exit Sub
End If
If Not (IsNull(Document_Path.Value)) Then
'get the last three characters of the file path, assuming that is the extension
fileExt = LCase(Right(Document_Path.Value, 3))
If fileExt = "pdf" Then
' show the pdf viewer, hide the media player control, set the pdf file path
PDFDisplay.Visible = True
WindowsMediaPlayer4.Visible = False
EDOffice7.Visible = False
returnVal = PDFDisplay.OpenFile(Document_Path.Value, "")
ElseIf fileExt = "wma" Or fileExt = "wav" Or fileExt = "avi" Then
' hide the pdf viewer, show the media player control, set the media player URL
PDFDisplay.Visible = False
WindowsMediaPlayer4.Visible = True
EDOffice7.Visible = False
WindowsMediaPlayer4.URL = Document_Path.Value
ElseIf fileExt = "doc" Or fileExt = "ocx" Or fileExt = "txt" Or fileExt = "rtf" Or fileExt = "xls" Or fileExt = "lsx" Or fileExt = "csv" Or fileExt = "ppt" Or fileExt = "ptx" Or fileExt = "pps" Then
' hide the pdf viewer, hide the media player control, show the Word file
WindowsMediaPlayer4.Visible = False
PDFDisplay.Visible = False
EDOffice7.Visible = True
returnVal = EDOffice7.Open(Document_Path.Value, "")
'The next two are commented out incase I need to break up the code for EDraw to work for each kind of file type.
'ElseIf fileExt = "xls" Or fileExt = "lsx" Or fileExt = "csv" Then
' hide the pdf viewer, hide the media player control, show the Excel file
'WindowsMediaPlayer4.Visible = False
'PDFDisplay.Visible = False
'ElseIf fileExt = "ppt" Or fileExt = "ptx" Or fileExt = "pps" Then
' hide the pdf viewer, hide the media player control, show the PowerPoint file
'WindowsMediaPlayer4.Visible = False
'PDFDisplay.Visible = False
Else
' we may end up finding another all purpose viewer for all our other format documents, like from the shared drive (MS Office, text, jpg, etc.)
' but for now, we can just default to showing the pdf viewer and hiding the media player
WindowsMediaPlayer4.Visible = False
PDFDisplay.Visible = True
WordView.Visible = False
End If
Else
' no valid filename value, so hide file viewing controls
PDFDisplay.Visible = False
WindowsMediaPlayer4.Visible = False
End If
Any ideas?