Académique Documents
Professionnel Documents
Culture Documents
How to use:
This code is best placed in your Personal workbook, so it is always available fo
r you to use
Copy the above code
In Excel press Alt + F11 to enter the Visual Basic Editor
Press Ctrl + R to show the Project Explorer
Right-click on the Personal file on left (in bold).
Choose Insert -> Module
Paste code into the right hand pane
Press Ctrl + S to Save the Personal file
Press Alt + Q to close the VB Editor
Test the code:
With Excel open, open a New blank worksheet (if there's not one there already) b
y pressing Ctrl + N
Click on any cell on the blank worksheet
Press Alt + F8 to open the Macro dialogue box (or select Tools > Macro > Macros
from the top Excel toolbar)
Look for the macro named PERSONAL.XLS!GetFileNames and click on it (if you can't
see it on the list, ensure that the bottom selection box states 'All Open Workb
ooks')
Click RUN (or double-click the macro name from the list)
The FileDialog box should now appear - navigate to the folder that you want to f
ind the contents so the target Folder name is in the top 'Look in:' field
Click OK
The names of all of the contained Files (and their file type extensions e.g. '.x
ls', '.bmp')will be added to the worksheet as a vertical list, starting in the c
ell you selected
Example1()
objFSO As Object
objFolder As Object
objFile As Object
i As Integer
.Item.To = "comanescu.raluca.m@gmail.com"
.Item.Subject = "Workbook Saved!"
' .Item.display
.Item.send
End With
End Sub
======================================================== 5 =====================
==================================================================
MsgBox