Microsoft Office Tutorials and References
In Depth Information
Creating a Contacts Database
' * * * * *¶
Private Function CreateFileName(strFileName() As String, _¶
fso As Object, fld As Object)¶
'Variable declaration¶
Dim strSuffix As String¶
Dim intSuffix As Integer¶
Dim strFinalFileName(1) As String¶
'Increment intSuffix until file is not existing¶
'FileExists method returns True if there is a file named¶
'with parameter string¶
Do Until Not fso.FileExists(fld.path & "\" & _¶
strFileName(0) & strSuffix & strFileName(1))¶
intSuffix = intSuffix + 1¶
'Create file name suffix¶
strSuffix = "_" & CStr(intSuffix)¶
strFinalFileName(0) = strFileName(0) & strSuffix¶
strFinalFileName(1) = strFileName(1)¶
'Return an array¶
'First item is the final file name¶
'Second item is the file extension¶
CreateFileName = strFinalFileName¶
End Function¶
Note: The target folder in the SelectFolder function procedure should be set to the
desired path.
Creating a Contacts Database
This macro creates an Access database file by using contacts information stored
in the Outlook Contacts folder. If the database file already exists, then the user
is prompted to update it or recreate (overwrite) it.
Scenario: Extracting information from the contacts in
Outlook is useful, even if it is for as simple a reason as to
have a backup of the information. The Excel section showed
how to do this to an Excel spreadsheet. Another option is to
save this information in an Access database.
View the Appendix to learn how to store this procedure
in a Standard module.
Search JabSto ::

Custom Search