PDA

View Full Version : Solved: Macro explain.



Pinokkio
02-12-2010, 10:30 AM
Is there anyone who can explain this macro?




Sub test()
Make [A1].Value, [A2].Value
End Sub

Sub Make(pathTemplate As String, pathNew As String)
'No trailing "\" in path names assummed.
Dim fso As Variant
Set fso = CreateObject("Scripting.FileSystemObject")
If Not fso.FolderExists(pathNew) Then fso.CreateFolder pathNew
fso.CopyFolder pathTemplate, pathNew, True 'True=Overwrite if files exist
fso.CopyFile ThisWorkbook (http://www.vbaexpress.com/forum/).FullName, pathNew & "\" & ThisWorkbook.Name
End Sub



It saves the file in folder in BB, that's all it does???

Cell A1 =C:\AA
Cell A2 =C:\BB

Thanks for the time spent in advance! :-)

Bob Phillips
02-12-2010, 11:09 AM
It seems to create the second folder, and copy everything from A1 foder to A2 folder.

Pinokkio
02-12-2010, 11:33 AM
Here is the site:
http://www.ozgrid.com/forum/showthread.php?t=71758



It seems to create the second folder,
If I remove C:\BB in cell A2
I get and ERROR


and copy everything from A1 folder to A2 folder.
It save the file in to folder BB wen I launch the macro.

Bob Phillips
02-13-2010, 06:46 AM
Of course you get an error, it doesn't test for no value.

What is the question now?

Pinokkio
02-13-2010, 11:43 AM
Thanks for reply.

P.