Andrewanalyst
New Member
- Joined
- Sep 3, 2014
- Messages
- 1
Hi guys,
I've been finding clues for my jobrelated excel problems on this forum numerous times. I didn't have to create new threads because i managed to resolve issues without it.
However, this time my boss assigned me a task i'm not skilled to do.
We created 10 financial models and 1 dashboard from which you can access and modify the models.
In this dashboard file i need to create a commandbutton which allows you to pick the financial models you wish to archive and pick the folder where you wish to archive them.
I've been struggling for several hours to do this, but i'm just VBA beginner.
This is the code i've created in the process (of course it doesn't work
).
Could you please help me modify it so that it functions as my boss expects it to?
i will be really grateful
________________
Private Sub CommandButton1_Click()
Dim ArchiveFolder
Dim PathArchiveFolder
Dim ModelsFiles As Integer
Dim PathModelsFiles As String
Dim i As Integer
Dim FSO As Object
Set FSO = VBA.CreateObject("scritping.filesystemobject")
'INDICATE ARCHIVE FOLDER
Application.FileDialog(msoFileDialogOpen).AllowMultiSelect = False
Application.FileDialog(msoFileDialogOpen).Title = _
"Choose folder for archivization:"
PathArchiveFolder = Application.FileDialog(msoFileDialogOpen).Show
'INDICATE EXCEL MODELS FILES
Application.FileDialog(msoFileDialogOpen).AllowMultiSelect = True
Application.FileDialog(msoFileDialogOpen).Title = _
"Choose excel models you wish to archive"
PathModelsFiles = Application.FileDialog(msoFileDialogOpen).Show
'COPY EXCEL MODELS FILES TO ARCHIVE FOLDER
??????????????
'FOR EACH COPIED FILE 1.OPEN FILE 2.HIGHLIGHT ALL SHEEETS AND ALL CELLS 3.COPY 4.PASTE AS VALUES 5. SAVE 6. CLOSE
??????????
If intChoice <> 0 Then
For i = 1 To Application.FileDialog(msoFileDialogOpen _
).SelectedItems.Count
strPath = Application.FileDialog(msoFileDialogOpen _
).SelectedItems(i)
FSO.copyfile(Modelsfiles,Archivefolder)
Next i
End If
'MODIFY FILE NAME: PASTE TODAY'S DATE AND '(archived)' before file name
?????
End Sub
I've been finding clues for my jobrelated excel problems on this forum numerous times. I didn't have to create new threads because i managed to resolve issues without it.
However, this time my boss assigned me a task i'm not skilled to do.
We created 10 financial models and 1 dashboard from which you can access and modify the models.
In this dashboard file i need to create a commandbutton which allows you to pick the financial models you wish to archive and pick the folder where you wish to archive them.
I've been struggling for several hours to do this, but i'm just VBA beginner.
This is the code i've created in the process (of course it doesn't work
Could you please help me modify it so that it functions as my boss expects it to?
i will be really grateful
________________
Private Sub CommandButton1_Click()
Dim ArchiveFolder
Dim PathArchiveFolder
Dim ModelsFiles As Integer
Dim PathModelsFiles As String
Dim i As Integer
Dim FSO As Object
Set FSO = VBA.CreateObject("scritping.filesystemobject")
'INDICATE ARCHIVE FOLDER
Application.FileDialog(msoFileDialogOpen).AllowMultiSelect = False
Application.FileDialog(msoFileDialogOpen).Title = _
"Choose folder for archivization:"
PathArchiveFolder = Application.FileDialog(msoFileDialogOpen).Show
'INDICATE EXCEL MODELS FILES
Application.FileDialog(msoFileDialogOpen).AllowMultiSelect = True
Application.FileDialog(msoFileDialogOpen).Title = _
"Choose excel models you wish to archive"
PathModelsFiles = Application.FileDialog(msoFileDialogOpen).Show
'COPY EXCEL MODELS FILES TO ARCHIVE FOLDER
??????????????
'FOR EACH COPIED FILE 1.OPEN FILE 2.HIGHLIGHT ALL SHEEETS AND ALL CELLS 3.COPY 4.PASTE AS VALUES 5. SAVE 6. CLOSE
??????????
If intChoice <> 0 Then
For i = 1 To Application.FileDialog(msoFileDialogOpen _
).SelectedItems.Count
strPath = Application.FileDialog(msoFileDialogOpen _
).SelectedItems(i)
FSO.copyfile(Modelsfiles,Archivefolder)
Next i
End If
'MODIFY FILE NAME: PASTE TODAY'S DATE AND '(archived)' before file name
?????
End Sub