Live-Forum - Die aktuellen Beiträge
Datum
Titel
28.03.2024 21:12:36
28.03.2024 18:31:49
Anzeige
Archiv - Navigation
1436to1440
Aktuelles Verzeichnis
Verzeichnis Index
Übersicht Verzeichnisse
Vorheriger Thread
Rückwärts Blättern
Nächster Thread
Vorwärts blättern
Anzeige
HERBERS
Excel-Forum (Archiv)
20+ Jahre Excel-Kompetenz: Von Anwendern, für Anwender
Aus Userform PDF Datei öffnen
02.08.2015 04:06:42
Sigi
Guten Morgen,
ich möchte aus einer Userform heraus eine PDF-Datei anzeigen lassen.
Leider funktioniert mein Code nicht.
Private Sub cmdPhoto_oeffnen_Click()
Dim sFile As String
Dim sPath As String
If cboPhoto_Ornder.Value = "" Then Exit Sub
sPath = "C:\Users\Documents\PDF_Dateien\" & cboName.Value & "\" & cboTitel.Value & "\"
sFile = cboPhoto_Ornder.Value
If Dir(sPath & sFile) = "" Then
Beep
MsgBox "Datei " & sFile & " wurde nicht gefunden!"
Else
Unload Me
CreateObject("WScript.Shell").Run "FoxitReader.exe"
'CreateObject("WScript.Shell").Open sPath & sFile
'CreateObject (sPath & sFile)
Shell (sPath & sFile)
End If
End Sub

Danke!
Gruß
Sigi

2
Beiträge zum Forumthread
Beiträge zu diesem Forumthread

Betreff
Datum
Anwender
Anzeige
AW: Aus Userform PDF Datei öffnen
02.08.2015 08:13:52
Nepumuk
Hallo,
teste mal:
Option Explicit

Private Declare PtrSafe Function ShellExecuteA Lib "shell32.dll" ( _
    ByVal hwnd As LongPtr, _
    ByVal lpOperation As String, _
    ByVal lpFile As String, _
    ByVal lpParameters As String, _
    ByVal lpDirectory As String, _
    ByVal nShowCmd As Long) As LongPtr

Private Const SW_SHOWMAXIMIZED As Long = 3

Private Sub cmdPhoto_oeffnen_Click()
    Dim sFile As String
    Dim sPath As String
    If cboPhoto_Ornder.Value <> "" Then
        sPath = "C:\Users\Documents\PDF_Dateien\" & cboName.Value & "\" & cboTitel.Value & "\"
        sFile = cboPhoto_Ornder.Value
        If Dir(sPath & sFile) = "" Then
            Beep
            MsgBox "Datei " & sFile & " wurde nicht gefunden!"
        Else
            Unload Me
            Call ShellExecuteA(0, "open", sPath & sFile, _
                vbNullString, vbNullString, SW_SHOWMAXIMIZED)
        End If
    End If
End Sub

Gruß
Nepumuk

Anzeige
o.T. Vielen Dank!
03.08.2015 02:13:21
Sigi
.

305 Forumthreads zu ähnlichen Themen

Anzeige
Anzeige
Anzeige

Links zu Excel-Dialogen

Beliebteste Forumthreads (12 Monate)

Anzeige

Beliebteste Forumthreads (12 Monate)

Anzeige
Anzeige
Anzeige