Visual Basic.NET - Problema al mandar a Exportar a Excel desde visual

 
Vista:

Problema al mandar a Exportar a Excel desde visual

Publicado por DARY (23 intervenciones) el 21/11/2016 17:33:34
Este es mi error que me aroja

No se encuentra el miembro público 'ExportToXls' en el tipo 'String'. Este es mi codigo:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
Sub Exportar(Opt As Integer) Dim Extension As String = String.Empty
 
    If Opt = 1 Then Extension = "*.xls"
    If Opt = 2 Then Extension = "*.xlsx"
    If Opt = 3 Then Extension = "*.pdf"
    If Opt = 4 Then Extension = "*.html"
    If Opt = 5 Then Extension = "*.rtf"
    If Opt = 6 Then Extension = "*.txt"
 
 
    If Opt <> 6 Then
        Guardar.DefaultExt = Extension
        Guardar.Filter = "(" & Extension & ")|" & Extension
 
        If Guardar.ShowDialog = DialogResult.OK Then
 
 
            If Opt = 1 Then GridP.ExportToXls(Guardar.FileName)
            If Opt = 2 Then GridP.ExportToXlsx(Guardar.FileName)
            If Opt = 3 Then GridP.ExportToPdf(Guardar.FileName)
            If Opt = 4 Then GridP.ExportToHtml(Guardar.FileName)
            If Opt = 5 Then GridP.ExportToRtf(Guardar.FileName)
            If Opt = 6 Then GridP.ExportToText(Guardar.FileName)
 
            If MessageBox.Show("¿ Abrir Archivo?", "Confirmar", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) = Windows.Forms.DialogResult.Yes Then
                Process.Start(Guardar.FileName)
            End If
        End If
        Me.Close()
    Else
        Me.Close()
        GridP.ShowPrintPreview()
    End If
End Sub
Muchas gracias de antemano
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder