Download Vbsedit to get sample files


' Extract Data from Multiple Excel Workbooks

Dim fso
Set fso = CreateObject("Scripting.Filesystemobject")

Set shell = CreateObject( "WScript.Shell" )
folder=shell.ExpandEnvironmentStrings("%LOCALAPPDATA%") & "\Vbsedit\Resources\"


ForEach fileIn fso.GetFolder(folder).Files
  extension=Mid(file.Name,InStrRev(file.Name,"."))

  If extension=".xlsx"Then

    Set objConn = CreateObject("ADODB.Connection")

    objConn.open"Provider=Microsoft.ACE.OLEDB.16.0; Data Source=" & file.Path & "; Extended Properties=""Excel 12.0;"";"

    Set ors = objConn.Execute("select * from [data$]")

    DoWhileNot(ors.EOF)
      WScript.Echo ors(0).Value & " " & ors(1).Value
      ors.MoveNext
    Loop

    ors.Close
    objConn.Close
  EndIf
Next

search for scripts

VbsEdit contains all these sample scripts!


Download Now!



Download   Home   Scripts

Copyright © 2001-2024 adersοft