Ik heb een vraag over een macro die ik heb gemaakt en automatisch bestanden opslaat in 2 verschillende mappen. Als ik de macro laat draaien in een nieuw document wordt het bestand opgeslage in de mappen die ik wil. Als ik de macro laat draaien in een geopend document worden de bestanden opgeslaan in de standaardlocatie van excel. Hoe kan ik die probleem oplossen?
Ik ben pas begonnen met vba dus mijn excuses als de code wat klungelig overkomt.
Sub SaveIt()
Dim ck As Boolean
str1 = "C:\Documents and Settings\My Documents\Januari 2008"
ck = Application.Dialogs(xlDialogSaveAs).Show(str1)
Dim Numberfile As String
Numberfile = InputBox("Enter number of the file")
If newName = "" Then
str2 = "C:\Documents and Settings\My Documents\Januari 2008\files\" & "D" & Format(Now, "YYYYmmdd") & Numberfile & ".csv"
Else
str1 = newName
End If
ck = Application.Dialogs(xlDialogSaveAs).Show(str2)
If ck = True Then
newName = ActiveWorkbook.Name
End If
End Sub
Bedankt
Ik ben pas begonnen met vba dus mijn excuses als de code wat klungelig overkomt.
Sub SaveIt()
Dim ck As Boolean
str1 = "C:\Documents and Settings\My Documents\Januari 2008"
ck = Application.Dialogs(xlDialogSaveAs).Show(str1)
Dim Numberfile As String
Numberfile = InputBox("Enter number of the file")
If newName = "" Then
str2 = "C:\Documents and Settings\My Documents\Januari 2008\files\" & "D" & Format(Now, "YYYYmmdd") & Numberfile & ".csv"
Else
str1 = newName
End If
ck = Application.Dialogs(xlDialogSaveAs).Show(str2)
If ck = True Then
newName = ActiveWorkbook.Name
End If
End Sub
Bedankt