Use of Everything from Excel VBA
Use of Everything from Excel VBA
Hej there,
I am not really a programmer, but at least a passionate user of VBA in Excel and Solidworks. I'd love to integrate everything in some of my VBA code, but failed so far:
- register the everything64.dll with regsvr32 does return an error
- set a reference in VBA does not work
- using the declare function does not work
Has anybody ever used the Everything SDK using VBA?
Does somebody have an example (I could not make the VB sample working on VBA)?
I am not really a programmer, but at least a passionate user of VBA in Excel and Solidworks. I'd love to integrate everything in some of my VBA code, but failed so far:
- register the everything64.dll with regsvr32 does return an error
- set a reference in VBA does not work
- using the declare function does not work
Has anybody ever used the Everything SDK using VBA?
Does somebody have an example (I could not make the VB sample working on VBA)?
Re: Use of Everything from Excel VBA
I only have the Visual Basic SDK example.
https://www.voidtools.com/Everything.SDK.Visual.Basic.Example.zip
Hope I can help..
https://www.voidtools.com/Everything.SDK.Visual.Basic.Example.zip
What happens?I could not make the VB sample working on VBA
Hope I can help..
Re: Use of Everything from Excel VBA
Find attached the Excel-File I used for my trials. I had to change some stuff in order to make it run in VBA (see header in this VBA module). It seems now to run, but it does always return a "0" on the GetNumResults request.
Would be really cool if you could find the solution for this

Re: Use of Everything from Excel VBA
The SDK requires Everything is running in the background.
Is Everything running in the background?
Trials_Everything.zip looks empty?
Is Everything running in the background?
Trials_Everything.zip looks empty?
Re: Use of Everything from Excel VBA
Everything is running in the background (always all day long...)
Re: Use of Everything from Excel VBA
Thanks for the Trials VBA.
I've made the following changes:
Notes:
Use LongPtr for strings.
I've made the following changes:
Code: Select all
'Note: sample copied from https://www.voidtools.com/support/everything/sdk/visual_basic/
'Replaced for VBA usage
' - UINT32 with LONG
' - UINT64 with LONGLONG
' - INTPtr with LONGPtr
' - System.Text.StringBuilder with String
' - System.DateTime with String
' - filename.Capacity with filesize
Public Declare PtrSafe Function Everything_SetSearchW Lib "C:\SDK\Everything64.dll" (ByVal ins As LongPtr) As Long
Public Declare PtrSafe Function Everything_SetRequestFlags Lib "C:\SDK\Everything64.dll" (ByVal dwRequestFlags As Long) As Long
Public Declare PtrSafe Function Everything_QueryW Lib "C:\SDK\Everything64.dll" (ByVal bWait As Integer) As Integer
Public Declare PtrSafe Function Everything_GetNumResults Lib "C:\SDK\Everything64.dll" () As Long
Public Declare PtrSafe Function Everything_GetResultFileNameW Lib "C:\SDK\Everything64.dll" (ByVal index As Long) As LongPtr
Public Declare PtrSafe Function Everything_GetLastError Lib "C:\SDK\Everything64.dll" () As Long
Public Declare PtrSafe Function Everything_GetResultFullPathNameW Lib "C:\SDK\Everything64.dll" (ByVal index As Long, ByVal ins As LongPtr, ByVal size As Long) As Long
Public Declare PtrSafe Function Everything_GetResultSize Lib "C:\SDK\Everything64.dll" (ByVal index As Long, ByRef size As LongLong) As Integer 'size UInt64
Public Declare PtrSafe Function Everything_GetResultDateModified Lib "C:\SDK\Everything64.dll" (ByVal index As Long, ByRef ft As LongLong) As Integer 'ft UInt64
Public Const EVERYTHING_REQUEST_FILE_NAME = &H1
Public Const EVERYTHING_REQUEST_PATH = &H2
Public Const EVERYTHING_REQUEST_FULL_PATH_AND_FILE_NAME = &H4
Public Const EVERYTHING_REQUEST_EXTENSION = &H8
Public Const EVERYTHING_REQUEST_SIZE = &H10
Public Const EVERYTHING_REQUEST_DATE_CREATED = &H20
Public Const EVERYTHING_REQUEST_DATE_MODIFIED = &H40
Public Const EVERYTHING_REQUEST_DATE_ACCESSED = &H80
Public Const EVERYTHING_REQUEST_ATTRIBUTES = &H100
Public Const EVERYTHING_REQUEST_FILE_LIST_FILE_NAME = &H200
Public Const EVERYTHING_REQUEST_RUN_COUNT = &H400
Public Const EVERYTHING_REQUEST_DATE_RUN = &H800
Public Const EVERYTHING_REQUEST_DATE_RECENTLY_CHANGED = &H1000
Public Const EVERYTHING_REQUEST_HIGHLIGHTED_FILE_NAME = &H2000
Public Const EVERYTHING_REQUEST_HIGHLIGHTED_PATH = &H4000
Public Const EVERYTHING_REQUEST_HIGHLIGHTED_FULL_PATH_AND_FILE_NAME = &H8000
Public Type FILETIME
dwLowDateTime As Long
dwHighDateTime As Long
End Type
Public Type SYSTEMTIME
wYear As Integer
wMonth As Integer
wDayOfWeek As Integer
wDay As Integer
wHour As Integer
wMinute As Integer
wSecond As Integer
wMilliseconds As Integer
End Type
Private Declare PtrSafe Function FileTimeToSystemTime Lib "kernel32" (ByRef ft As LongLong, lpSystemTime As SYSTEMTIME) As Long
Private Declare PtrSafe Function SystemTimeToTzSpecificLocalTime Lib "kernel32" (ByVal tzi As LongPtr, lpst As SYSTEMTIME, lplt As SYSTEMTIME) As Long
Private Declare PtrSafe Function SystemTimeToVariantTime Lib "OLEAUT32.DLL" (lpSystemTime As SYSTEMTIME, vtime As Date) As Long
Sub SimpleTest()
Dim EyText As String
Dim test As Boolean
EyText = "Everything"
Everything_SetSearchW (StrPtr(EyText))
Everything_SetRequestFlags (EVERYTHING_REQUEST_FILE_NAME Or EVERYTHING_REQUEST_PATH Or EVERYTHING_REQUEST_SIZE Or EVERYTHING_REQUEST_DATE_MODIFIED)
test = Everything_QueryW(True)
Debug.Print test
Dim NumResults As Long
Dim i As Long
Dim filename As String
Dim filesize As Long
Dim size As LongLong
Dim ftdm As LongLong
Dim stdm As SYSTEMTIME
Dim ltdm As SYSTEMTIME
Dim DateModified As Date
filename = String(260, 0)
NumResults = Everything_GetNumResults()
Debug.Print NumResults
If NumResults > 0 Then
For i = 0 To NumResults - 1
test = Everything_GetResultFullPathNameW(i, StrPtr(filename), 260)
Debug.Print filename
test = Everything_GetResultSize(i, size)
Debug.Print size
test = Everything_GetResultDateModified(i, ftdm)
test = FileTimeToSystemTime(ftdm, stdm)
test = SystemTimeToTzSpecificLocalTime(0, stdm, ltdm)
test = SystemTimeToVariantTime(ltdm, DateModified)
Debug.Print DateModified
Next
End If
End Sub
Use LongPtr for strings.
Re: Use of Everything from Excel VBA
WOW, it does work, You are the best!!!