Kirius
asked on
Open .xls with viewer
I have a program that will open .xls files with the full version of excel. How can i get it to open the fiels with excel viewer. This is with Visual Basic 6
ASKER
Well what I have is a program where you can choose what .xls you want to view. Each .xls has about 10-50 sheets in it. I can open it fine on workstations with full versions of office. But some workstations, I don't want to use Internet Explorer or Full version excel because they don't have it on those. But to open it with Excel Viewer.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" ( _
ByVal hwnd As Long, _
ByVal lpOperation As String, _
ByVal lpFile As String, _
ByVal lpParameters As String, _
ByVal lpDirectory As String, _
ByVal nShowCmd As Long) As Long
Private Sub Command1_Click()
Dim xlsPath, xlsVwr As String
Dim retVal As Long
'Path of excelviewer can be extracted out of the registry.
'
'HKEY_CLASSES_ROOT\Applica tions\xlvi ew.exe\she ll\open\co mmand
'@="C:\\PROGRA~1\\MICROS~3 \\OFFICE11 \\XLVIEW.E XE /e"
xlsVwr = "C:\PROGRA~1\MICROS~3\OFFI CE11\XLVIE W.EXE"
'Path of the XLS File
xlsPath = App.Path & "\map1.xls"
'Run the Viewer
retVal = ShellExecute(Me.hwnd, "Open", xlsVwr, xlsPath, "", 1)
End Sub
ByVal hwnd As Long, _
ByVal lpOperation As String, _
ByVal lpFile As String, _
ByVal lpParameters As String, _
ByVal lpDirectory As String, _
ByVal nShowCmd As Long) As Long
Private Sub Command1_Click()
Dim xlsPath, xlsVwr As String
Dim retVal As Long
'Path of excelviewer can be extracted out of the registry.
'
'HKEY_CLASSES_ROOT\Applica
'@="C:\\PROGRA~1\\MICROS~3
xlsVwr = "C:\PROGRA~1\MICROS~3\OFFI
'Path of the XLS File
xlsPath = App.Path & "\map1.xls"
'Run the Viewer
retVal = ShellExecute(Me.hwnd, "Open", xlsVwr, xlsPath, "", 1)
End Sub
Private Sub Command1_Click()
WebBrowser1.Navigate2 "C:\Test.xls"
End Sub