Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Combine Text Files in Current Directory 1

Status
Not open for further replies.

Nu2Java

Technical User
Jun 5, 2012
166
0
0
US
Hello, I am not very familiar with this line of code and how to modify it with a variable.

Code:
Set FileList = objWMIService.ExecQuery _
    ("ASSOCIATORS OF {Win32_Directory.Name='C:\Temp'} Where " _
        & "ResultClass = CIM_DataFile")

How do I change the line for the path to use a variable for current directory? Instead of calling a path between ' ' I was trying to enter a variable for the current directory, but I kept getting errors.

Thanks!
 
Like this ?
Code:
strPath = "C:\Temp"
Set FileList = objWMIService.ExecQuery _
    ("ASSOCIATORS OF {Win32_Directory.Name='"  & strPath & "'} Where " _
        & "ResultClass = CIM_DataFile")

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Thanks PHV .... I wasn't putting the double quotes. Works great!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top