Download Vbsedit to get sample files   Learn more about schema.ini


' Create a Pivot Table Without Excel
' using Vbsedit's free Toolkit

Set objConn = CreateObject("ADODB.Connection")

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

objConn.open"Provider=Microsoft.ACE.OLEDB.16.0; Data Source=" & folder & ";Extended Properties=""Text;"";"

Set pivot = CreateObject("Vbsedit.PivotTable")
pivot.Initialize3,1

Set ors = objConn.Execute("select * from [pivot.csv]")

DoWhileNot(ors.EOF)
  pivot.Add ors("Date").Value,ors("Name").Value,ors("Category").Value,ors("Value1").Value
  ors.MoveNext
Loop

ors.Close
objConn.Close

pivot.Finalize

pivot.SaveToFile currentdir & "pivot.piv"

Foreach item1In pivot.Axe(1)
  Set rowTotal1 = pivot.Aggregate(item1.ID)
  WScript.Echo item1.Label & "[Total:" & rowTotal1.Measure(1) & "]"
  Foreach item2In pivot.Axe(2)
    Set rowTotal2 = pivot.Aggregate(item1.ID,item2.ID)
    WScript.Echo"  " & item2.Label & " [Total: " & rowTotal2.Measure(1) & "]"
    Foreach item3In pivot.Axe(3)
      Set row = pivot.Aggregate(item1.ID,item2.ID,item3.ID)
      WScript.Echo"    " & row.Label(3) & ": " & row.Measure(1)
    Next
  Next
Next

Set rowTotal = pivot.Aggregate()
WScript.Echo"[Grand Total: " & rowTotal.Measure(1) & "]"
search for scripts

VbsEdit contains all these sample scripts!


Download Now!



Download   Home   Scripts

Copyright © 2001-2024 adersοft