View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
excel interop webBrowser navigate office excel interop webBrowser navigate office is offline
external usenet poster
 
Posts: 1
Default I need help to make a viewer files EXCEL

Hi, I am developing a viewer excel files with visual studio 2005 but I
presents a problem: the program does not work well until excel return to
close my application. One suggestion was that I got to use this importation
"Imports Microsoft.Office.Interop" but my visual studio does not recognize
it, which I do?
This is my original code:

Public Class Form1
Dim file As String
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click

buscarArchivo()
End Sub

Public Sub buscarArchivo()
Dim oExcel As Microsoft.Office.Interop.Excel.Application
Dim op As New OpenFileDialog
op.Filter = "Archivos de Imagenes *.xls|*.xls|Imágenes tipo
*.xls|*.xls"
file = ""
If op.ShowDialog = Windows.Forms.DialogResult.OK Then
file = op.FileName
WebBrowser1.Navigate(file)
End If
End Sub

End Class


And this is the suggestion that I gave, but still does not work for me
because I can not make reference to certain commands:
Dim objExcel As New Excel.Application
Dim wbExcel As Excel.Workbook
file = "C:MiArchivo.xls"
objExcel = New Excel.Application
wbCupon = objExcel.Workbooks.Open(file)
objExcel.Visible = True

Perhaps I can help you please!

atte.
zynid3as
----------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------
Here I was trying to almost like a code, but now no longer open files within
the webBrowser but callers to the implementation of MS Excel to open it. I am
working with the version of MS Office Excel 2007. :

Public Sub buscarArchivo()
Dim op As New OpenFileDialog
Dim objExcel As New Excel.Application
Dim wbExcel As Excel.Workbook
With op
.Filter = "Office Documents " & _
"(*.doc, *.xls, *.ppt)|*.doc;*.xls;*.ppt"
.FilterIndex = 1
End With
If op.ShowDialog = Windows.Forms.DialogResult.OK Then
file = op.FileName
oDocument = Nothing

wbExcel = objExcel.Workbooks.Open(file)
objExcel.Visible = True
End If
End Sub

------------------------------------------------------------------------------------------------
zynid3as