ich hoffe mir kann geholfen werden.
Ich habe in Excel und VBA eine Rezepturverwaltung für eine Gastronomie angelegt.
Hierbei wird in Zelle M4 der Lieferant des Produktes ausgewählt, welche über eine Datenprüfung ausgewählt werden kann.
Die ersten 6 Case Varianten funktionieren, die beiden letzten nicht. Pfade sind angelegt und überprüft.
Debug.Print bringt mich nicht weiter.
Verzeichnispfad habe ich bereits genaustens aufgeschlüsselt.
Vielleicht kann mir wer weiterhelfen:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim sourceFile As String
Dim targetPath As String
Dim newFile As String
Dim explorerPath As String
' Set source file path
sourceFile = "\\192.168.0.11\Firma Lisa Rühl\Gastronomie\Allergen Dokumentation\Vorlage_DEHOGA.pdf"
' Set target folder for copied file
targetPath = "\\192.168.0.11\Firma Lisa Rühl\Gastronomie\Allergen Dokumentation\Eigene Rezepturen\"
' Check if cell M4 has changed
If Target.Address = "$M$4" Then
Debug.Print "Cell M4 has changed."
Select Case UCase(Target.Value)
Case "EIGENE"
Debug.Print "Selected Value: EIGENE"
newFile = targetPath & Range("D2").Value & ".pdf"
FileCopy sourceFile, newFile
Shell "explorer.exe """ & newFile & """"
Case "TILA LACHENMAIER"
Debug.Print "Selected Value: TILA LACHENMAIER"
explorerPath = "\\192.168.0.11\Firma Lisa Rühl\Gastronomie\Allergen Dokumentation\Tila Lachenmaier\"
Shell "explorer.exe """ & explorerPath & """", vbNormalFocus
MsgBox "Bitte Allergen Dokumentation einfügen"
Case "HERMANN HÖFFLER"
Debug.Print "Selected Value: HERMANN HÖFFLER"
explorerPath = "\\192.168.0.11\Firma Lisa Rühl\Gastronomie\Allergen Dokumentation\Hermann Höffler\"
Shell "explorer.exe """ & explorerPath & """", vbNormalFocus
MsgBox "Bitte Allergen Dokumentation einfügen"
Case "SCHÖLLKOPF"
Debug.Print "Selected Value: SCHÖLLKOPF"
explorerPath = "\\192.168.0.11\Firma Lisa Rühl\Gastronomie\Allergen Dokumentation\Schöllkopf\"
Shell "explorer.exe """ & explorerPath & """", vbNormalFocus
MsgBox "Bitte Allergen Dokumentation einfügen"
Case "MEGA"
Debug.Print "Selected Value: MEGA"
explorerPath = "\\192.168.0.11\Firma Lisa Rühl\Gastronomie\Allergen Dokumentation\MEGA\"
Shell "explorer.exe """ & explorerPath & """", vbNormalFocus
MsgBox "Bitte Allergen Dokumentation einfügen"
Case "EDEKA"
Debug.Print "Selected Value: Foodservice"
explorerPath = "\\192.168.0.11\Firma Lisa Rühl\Gastronomie\Allergen Dokumentation\EDEKA\"
Shell "explorer.exe """ & explorerPath & """", vbNormalFocus
MsgBox "Bitte Allergen Dokumentation einfügen"
Case "Denis Wiedmann"
Debug.Print "Selected Value: Denis Wiedmann"
explorerPath = "\\192.168.0.11\Firma Lisa Rühl\Gastronomie\Allergen Dokumentation\Denis Wiedmann\"
Shell "explorer.exe """ & explorerPath & """", vbNormalFocus
MsgBox "Bitte Allergen Dokumentation einfügen"
Case "Colona"
Debug.Print "Selected Value: Colona"
explorerPath = "\\192.168.0.11\Firma Lisa Rühl\Gastronomie\Allergen Dokumentation\Colona\"
Shell "explorer.exe """ & explorerPath & """", vbNormalFocus
MsgBox "Bitte Allergen Dokumentation einfügen"
End Select
End If
End Sub