ich suche einen Code der mir meine Datei in einem vorbestimmen Pfad speichert. Es soll jedoch nicht der Win-Explorer geöffnet werden, während der Laufzeit. Gib es da etwas....?
Danke vorab.
Sub speichern()
Dim strPathAndName As String
strPathAndName = "E:\Forum\Meine Datei.xlsm"
ThisWorkbook.SaveAs strPathAndName, 52
End Sub
Sub speichern()
Dim strPathAndName As String
On Error Resume Next
strPathAndName = "E:\Forum\Meine Datei.xlsm"
ThisWorkbook.SaveAs strPathAndName, 52
End Sub
' **********************************************************************
' Modul: Modul1 Typ: Allgemeines Modul
' **********************************************************************
Option Explicit
Private Declare Function MakeSureDirectoryPathExists Lib "imagehlp.dll" (ByVal lpPath As String) As Long
Sub speichern()
Dim strPath As String
Dim strFileName As String
Dim bDoIt As Boolean
bDoIt = True
strPath = "E:\Forum"
strFileName = "Meine Datei.xlsm"
If Right(strPath, 1) <> "\" Then strPath = strPath & "\"
If Dir(strPath, vbDirectory) = "" Then
bDoIt = False
If MsgBox("Der Pfad '" & strPath & "' existiert nicht!" & vbLf & _
"Soll dieser Pfad angelegt werden?", vbExclamation + vbYesNo) = vbYes Then
Call MakeSureDirectoryPathExists(strPath)
bDoIt = True
End If
End If
If bDoIt Then ThisWorkbook.SaveAs strPath & strFileName, 52
End Sub
Sub speichern()
Dim strPathAndName As String
strPathAndName = "E:\Forum\Meine Datei.xlsm"
ThisWorkbook.SaveAs strPathAndName, 52
End Sub
Die Datei wird entsprechend im angebenen Pfad gespeichert, jedoch wird die aktive Datei nicht unbenannt. Die heißt, nach Ablauf des Code´s noch immer Mappe1. Kann man das beeinflussen?
ActiveWorkbook.SaveAs strPathAndName, 52
Gruss Daniel