[VBA] macro archive file

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
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"

Forum statistics

Threads
1,190,911
Messages
5,983,525
Members
439,848
Latest member
timmyo

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top