Saltar al contenido

Abrir archvos PDF en Excel

publicado

Buenos días

Necesito ayuda en un programa en el cual trato de abrir archivos PDF desde Excel, ya tengo parte del código en el cual me abre una ventana la cual trata de mostrarme el archivo pero no me aparece nada más, ademas ya agregue la ruta y aún así no me deja abrir los archivos.

La pagina no me deja adjuntarlo pero agradecería mucho si alguien me pudiera ayudar por correo. 

 

Featured Replies

publicado
  • Autor

Gracias, mire aqui dejo el código que utilice en el programa y no se porque no me deje abrir los archivos PDF, aunque no se si necesite también el documento.

 

Sub calPDF()
i = Selection.Row
j = Selection.Column
If Cells(i, j) <> "" And i > 2 Then
    Dim s As String
    Dim s1 As Worksheet
    Set s1 = Sheets("Doc")
    Dim wf As String
    wf = Application.ActiveWorkbook.Path
    s = wf & "\" & Cells(i, j) & ".pdf"
    Debug.Print "File to open: " & s
    LoadPDF s, 1
End If
End Sub

Sub LoadPDF(FicPdf As String, NoPage As Integer)
    'Object creation
    Set mObjPDF = PdfForm.Controls.Add("AcroPDF.PDF.1", "VisuPDF")
    ch = mObjPDF.src
    'get the acrobat version
    ver = mObjPDF.GetVersions
    'Window object parameters
    With PdfForm.Controls("VisuPDF")
      .Visible = True
      'Height and width of the window
      .Height = PdfForm.Height - 20
      .Width = PdfForm.Width - 5
    'mObjPDF.setViewRect 0, 0, 650, 580
    End With
    'Parameters of the object AcroPdf
    With mObjPDF
      .src = FicPdf 'Filename or URL
      .setShowScrollbars (True)
      .setShowToolbar (True)
      .setPageMode ("none") 'none/bookmarks/thumbs
      .setLayoutMode ("SinglePage") 'DontCare/SinglePage/OneColumn/TwoColumnLeft/TwoColumnRight
      .setCurrentPage (NoPage) 'Page number
      .setView ("Fit") 'Fit/FitH/FitV/FitB/FitBH/FitB
      '.setZoom (100)
    End With
    PdfForm.Show
End Sub
 

 

 

Archivado

Este tema está ahora archivado y está cerrado a más respuestas.