![]() |
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 |
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 |
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 |
All times are GMT +1. The time now is 11:13 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com