Microsoft Office Tutorials and References
In Depth Information
Creating a Folder Tree Menu
'Store the path in the Tag property¶
'so that OnAction macro can access it¶
.Tag = path¶
'Only Word 2002/2003 support adding a¶
'picture from a file¶
If Application.Version >= 10 Then¶
AddButtonPicture ctl, filetype¶
End If¶
End With¶
End Function¶
' * * * * *¶
Function GetFileType(s As String) As String¶
'Variable declaration¶
Dim ext As String¶
Dim loc As Long¶
'The file extension follows the last .¶
'in the filename. Determine¶
'at which position this is¶
loc = InStr(s, ".")¶
'Loop until no more . are found¶
'What's left in the ext string is the file extension¶
Do¶
ext = Mid(s, loc + 1)¶
loc = InStr(ext, ".")¶
s = ext¶
Loop Until loc = 0¶
'Set the file type, based on the extension¶
Select Case ext¶
Case "doc", "dot", "htm", "html", _¶
"rtf", "txt", "csv"¶
GetFileType = "Word"¶
Case "xls"¶
GetFileType = "Excel"¶
Case "ppt"¶
GetFileType = "Powerpoint"¶
Case "bmp", "gif", "jpg", "tif"¶
GetFileType = "Graphic"¶
Case Else¶
GetFileType = "unknown"¶
End Select¶
End Function¶
' * * * * *¶
Function buttonExists( _¶
cb As Office.CommandBar, _¶
s As String) As Boolean¶
Dim c As Office.CommandBarControl¶
buttonExists = False¶
Wrd
Search JabSto ::




Custom Search