Home |
Search |
Today's Posts |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
This should work after a buttonclick...
Option Explicit Private Declare Function ShellExecute Lib "shell32.dll" Alias _ "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, _ ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory _ As String, ByVal nShowCmd As Long) As Long Private Sub Worksheet_Button_SearchECW_Click() Dim searchPath, ecwFile As String Dim fso, fs, fc, f searchPath = ThisWorkbook.Path & "\" Set fso = CreateObject("Scripting.FileSystemObject") Set fs = fso.GetFolder(searchPath) Set fc = fs.Files For Each f In fc If Right(f.Name, 4) = ".ECW" Then ecwFile = f.Name Exit For End If Next f Set f = Nothing Set fc = Nothing Set fs = Nothing Set fso = Nothing ShellExecute vbNull, vbNullString, ecwFile, vbNullString, searchPath, 1 End Sub "2007-User" schreef in bericht ... Hi Guys, I need a VBA to be able to search for a file with specific extension (like "ecw"), and have another application to open that file. (search for the file can be in the same directory that the correct open excel file is existing) How this is possible? Any help would be appreciated. |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Search for specific value | Excel Programming | |||
Transformation d'images avec une extension .jpg ou .jpeg en images avec extension .bmp ou .ico | Excel Discussion (Misc queries) | |||
DELETING FILES FROM A FOLDER WITH SPECIFIC EXTENSION | Excel Programming | |||
Excel XP VBA code to search all macro code in Excel module for specific search string criteria | Excel Programming | |||
Excel XP VBA code to search all macro code in Excel module for specific search string criteria | Excel Programming |