Log in  \/ 
x
or
x
x
Register  \/ 
x

or

unanswered Get the path details with file name

More
3 months 2 weeks ago #1971 by mehidy1437
Get the path details with file name was created by mehidy1437
Hi Guys,
How can I get file path details with their name & extension in below code?

How to list all opening (currently running) applications in Excel?  



[code]Private
Declare
PtrSafe 
Function
apiGetClassName 
Lib
"user32"
Alias
_
                
"GetClassNameA"
(
ByVal
Hwnd 
As
Long
, _
                
ByVal
lpClassname 
As
String
, _
                
ByVal
nMaxCount 
As
Long
As
Long
Private
Declare
PtrSafe 
Function
apiGetDesktopWindow 
Lib
"user32"
Alias
_
                
"GetDesktopWindow"
() 
As
Long
Private
Declare
PtrSafe 
Function
apiGetWindow 
Lib
"user32"
Alias
_
                
"GetWindow"
(
ByVal
Hwnd 
As
Long
, _
                
ByVal
wCmd 
As
Long
As
Long
Private
Declare
PtrSafe 
Function
apiGetWindowLong 
Lib
"user32"
Alias
_
                
"GetWindowLongA"
(
ByVal
Hwnd 
As
Long
ByVal
_
                
nIndex 
As
Long
As
Long
Private
Declare
PtrSafe 
Function
apiGetWindowText 
Lib
"user32"
Alias
_
                
"GetWindowTextA"
(
ByVal
Hwnd 
As
Long
ByVal
_
                
lpString 
As
String
ByVal
aint 
As
Long
As
Long
Private
Const
mcGWCHILD = 5
Private
Const
mcGWHWNDNEXT = 2
Private
Const
mcGWLSTYLE = (-16)
Private
Const
mcWSVISIBLE = &H10000000
Private
Const
mconMAXLEN = 255
 
Sub
ListName()
    
Dim
xRg 
As
Range
    
Dim
xStr 
As
String
    
Dim
xStrLen 
As
Long
    
Dim
xHandle 
As
Long
    
Dim
xHandleStr 
As
String
    
Dim
xHandleLen 
As
Long
, xHandleStyle 
As
Long
    
On
Error
Resume
Next
    
Set
xRg = Application.InputBox(
"Please select a range(single cell):"
"KuTools For Excel"
, ActiveWindow.RangeSelection.Address, , , , , 8)
    
If
xRg 
Is
Nothing
Then
Exit
Sub
    
xRg(1).Activate
    
xHandle = apiGetWindow(apiGetDesktopWindow(), mcGWCHILD)
    
Do
While
xHandle <> 0
        
xStr = 
String
$(mconMAXLEN - 1, 0)
        
xStrLen = apiGetWindowText(xHandle, xStr, mconMAXLEN)
        
If
xStrLen > 0 
Then
            
xStr = Left$(xStr, xStrLen)
            
xHandleStyle = apiGetWindowLong(xHandle, mcGWLSTYLE)
            
If
xHandleStyle 
And
mcWSVISIBLE 
Then
                
ActiveCell.Value = xStr
                
ActiveCell.Offset(1, 0).Activate
            
End
If
        
End
If
        
xHandle = apiGetWindow(xHandle, mcGWHWNDNEXT)
    
Loop
End
Sub
[/code]

Please Log in or Create an account to join the conversation.

Moderators: jaychivoExcelfansqiuhongkun