Hallo
Ich habe ein Programm geschrieben das auf eine Konvertierung von Dateien in das pdf Format zugreift und die Vorbereitung für die Konvertierung vereinfachen soll.
Bei zwei Dingen weiss ich aber nicht mehr weiter.
1. würde ich gerne prüfen wann die pdf Datei konvertiert ist und im Laufwerk V:\...\pdfout erscheint um anzuzeigen das die Konvertierung fertig ist und um die Datei in das Laufwerk zu kopieren aus dem die Ursprungsdatei stammt.
2. Würde ich gerne dieses Programm direkt aus dem Windows Explorer starten und zwar soll das zu konvertierende File ausgewählt werden und über die rechte Maustaste das Programm gestartet werden alllerdings fehlt mir hierzu eine geschickte Lösung.
Wäre super wenn mir jemand weiterhelfen könnte.
Falls es weiterhilft
Mein Code sind wie folgt aus:
// Lirion: Code-Tags eingefügt. Bei längeren Codes bitte selbst dran denken.
Ich habe ein Programm geschrieben das auf eine Konvertierung von Dateien in das pdf Format zugreift und die Vorbereitung für die Konvertierung vereinfachen soll.
Bei zwei Dingen weiss ich aber nicht mehr weiter.
1. würde ich gerne prüfen wann die pdf Datei konvertiert ist und im Laufwerk V:\...\pdfout erscheint um anzuzeigen das die Konvertierung fertig ist und um die Datei in das Laufwerk zu kopieren aus dem die Ursprungsdatei stammt.
2. Würde ich gerne dieses Programm direkt aus dem Windows Explorer starten und zwar soll das zu konvertierende File ausgewählt werden und über die rechte Maustaste das Programm gestartet werden alllerdings fehlt mir hierzu eine geschickte Lösung.
Wäre super wenn mir jemand weiterhelfen könnte.
Falls es weiterhilft
Mein Code sind wie folgt aus:
Code:
Option Explicit
Dim FilenameX As String
Dim DriveX As String
Dim PathX As String
Dim FileX As String
Dim ExtensionX As String
Private Sub Drive1_Change()
Dir1.Path = Drive1.Drive
End Sub
Private Sub Dir1_Change()
File1.Path = Dir1.Path
End Sub
Private Sub File1_Click()
Dim FullPath As String
Dim QuellPath As String
Dim ZielPath As String
Dim ZielPathA As String
Dim FileOut As String
Dim PauseTime, Start, Finish
'Aufruf der Prozedur zum aufteilen des Pfades seine einzelnen Komponenten
FullPath = Dir1 & File1
SplitPath FullPath
'Selektiert die angewählte Datei nach der Extension, kopiert diese in
'den entsprechenden Pfad und bereitet und bereitet die Konvertierung vor
Select Case ExtensionX
Case "doc", "xls"
QuellPath = FullPath
ZielPath = "\\pre-wap-konv1\wrdxls-in\" & FilenameX
FileCopy QuellPath, ZielPath
ZielPathA = ZielPath & "a"
FileCopy ZielPath, ZielPathA
Name ZielPathA As "\\pre-wap-konv1\wrdxls-in\" & FileX & ".rdy"
Case "gl2", "ps", "plt", "hp2", "hpl", "tif", "eps", "EPS", "PS"
QuellPath = FullPath
ZielPath = "\\pre-wap-konv1\Konvertierung\hpgltiffps\" & FilenameX
FileCopy QuellPath, ZielPath
ZielPathA = ZielPath & "a"
FileCopy ZielPath, ZielPathA
Name ZielPathA As "\\pre-wap-konv1\Konvertierung\hpgltiffps\" & FileX & ".rdy"
Case Is <> "xls", "doc", "gl2", "ps", "plt", "hp2", "hpl", "tif"
MsgBox "Fileformat is not convertable!" & "Please choose the correct format!", _
vbExclamation, "Attention!"
Exit Sub
End Select
ChDir "\\pre-wap-konv1\Konvertierung\"
Drive1.Drive = "\\pre-wap-konv1\Konvertierung\"
Dir1.Path = "\\pre-wap-konv1\Konvertierung\pdfout"
MsgBox " Please wait a few seconds! Conversion is running!", vbInformation
PauseTime = 30
Start = Timer
Do While Timer < Start + PauseTime
File1.Filename = Dir1 & "\" & "*.*"
KonvFile = Dir1 & "\" & FileX & ".pdf"
If Dir(KonvFile) = FileX & ".pdf" Then
Finish = Timer
End If
Loop
MsgBox " Convertion is finished! ", vbInformation
QuellPath = Dir1 & "\" & FileX & ".pdf"
ZielPath = PathX & "\" & FileX & ".pdf"
FileCopy QuellPath, ZielPath
Kill QuellPath
Drive1.Drive = DriveX
File1.Filename = Dir1 & "\" & "*.*"
End Sub
'Prozedur zur Aufteilung des übergebenen Pfades in seine einzelnen
'Komponenten - Laufwerk, Ordner, Datei
Public Sub SplitPath(FullPath As String, Optional Drive As String, _
Optional Path As String, Optional Filename As String, _
Optional File As String, Optional Extension As String)
Dim nPos As Integer
nPos = InStrRev(FullPath, "\")
If nPos Then
If Left$(FullPath, 2) = "\\" Then
If nPos = 2 Then
Drive = FullPath
Path = ""
Filename = ""
File = ""
Extension = ""
Exit Sub
End If
End If
Path = Left$(FullPath, nPos - 1)
PathX = Path
Filename = Mid$(FullPath, nPos + 1)
FilenameX = Filename
nPos = InStrRev(Filename, ".")
If nPos Then
File = Left$(Filename, nPos - 1)
FileX = File
Extension = Mid$(Filename, nPos + 1)
ExtensionX = Extension
Else
File = Filename
Extension = ""
End If
Else
Path = FullPath
Filename = ""
File = ""
Extension = ""
End If
If Left$(Path, 2) = "\\" Then
nPos = InStr(3, Path, "\")
If nPos Then
Drive = Left$(Path, nPos - 1)
Else
Drive = Path
End If
Else
If Len(Path) = 2 Then
If Right$(Path, 1) = ":" Then
Path = Path & "\"
End If
End If
If Mid$(Path, 2, 2) = ":\" Then
Drive = Left$(Path, 2)
DriveX = Drive & "\"
End If
End If
End Sub
// Lirion: Code-Tags eingefügt. Bei längeren Codes bitte selbst dran denken.

Zuletzt bearbeitet von einem Moderator: