Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Help with using vba to determine file associations
How can I use vba to determine what the associated image viewing program is
? e.g. AcdSee, Microsoft Picture Viewer etc Regards & TIA |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Help with using vba to determine file associations
Hi Nice but Dim,
Private Declare Function FindExecutable& Lib "shell32.dll" Alias _ "FindExecutableA" (ByVal lpFile$, ByVal lpDirectory$, ByVal lpResult$) Private Function GetFileAssociation$(ByVal sFile$) GetFileAssociation = "File not found !" If Dir(sFile) = "" Or sFile = "" Then Exit Function GetFileAssociation = "No association found !" Dim i&, E$: E = String(260, Chr$(0)) i = FindExecutable(sFile, vbNullString, E) If i 32 Then GetFileAssociation = Left$(E, InStr(E, Chr$(0)) - 1) End Function Sub Test() MsgBox GetFileAssociation("C:\Iceberg.jpg"), 64 End Sub Regards, MP "Nice but Dim" a écrit dans le message de news: ... How can I use vba to determine what the associated image viewing program is ? e.g. AcdSee, Microsoft Picture Viewer etc Regards & TIA |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Help with using vba to determine file associations
Many thanks Michel,
You guys are amazing Regards Jim (Nice but dim) "Michel Pierron" wrote in message ... Hi Nice but Dim, Private Declare Function FindExecutable& Lib "shell32.dll" Alias _ "FindExecutableA" (ByVal lpFile$, ByVal lpDirectory$, ByVal lpResult$) Private Function GetFileAssociation$(ByVal sFile$) GetFileAssociation = "File not found !" If Dir(sFile) = "" Or sFile = "" Then Exit Function GetFileAssociation = "No association found !" Dim i&, E$: E = String(260, Chr$(0)) i = FindExecutable(sFile, vbNullString, E) If i 32 Then GetFileAssociation = Left$(E, InStr(E, Chr$(0)) - 1) End Function Sub Test() MsgBox GetFileAssociation("C:\Iceberg.jpg"), 64 End Sub Regards, MP "Nice but Dim" a écrit dans le message de news: ... How can I use vba to determine what the associated image viewing program is ? e.g. AcdSee, Microsoft Picture Viewer etc Regards & TIA |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Excel XP and Excel 2007 file associations | Excel Discussion (Misc queries) | |||
Problem changing file associations in Excel 2007 | Excel Discussion (Misc queries) | |||
Opening and file associations for Excel | Excel Discussion (Misc queries) | |||
VBA code to itemize range names and associations? | Excel Programming | |||
Excel hyperlink file associations - GIF | Excel Programming |