Created
March 12, 2014 02:23
-
-
Save aptavout/9499531 to your computer and use it in GitHub Desktop.
Programmatic PivotTable using the VBA you already wrote (or recorded)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Const xlHTMLStatic = 0 | |
Set args = Wscript.Arguments | |
Set objShell = CreateObject("Wscript.Shell") | |
htmPath = Wscript.Arguments.Item(0) | |
personalWb = objShell.ExpandEnvironmentStrings("%PERSONALWB%") | |
Set oXl = CreateObject("Excel.Application") | |
Set oPersonal = oXl.Workbooks.Open(personalWb) | |
oXl.Run oPersonal.Name & "!Module1.HelloWorld","hi" | |
Set oLogWb = oXl.ActiveWorkbook | |
oLogWb.PublishObjects.Add(4, htmPath & "\outlook-body.htm", "Sheet1", _ | |
oLogWb.Sheets("Sheet1").Range("A:AE").Address, xlHTMLStatic).Publish (True) | |
oXl.ActiveWorkbook.Close False | |
oPersonal.Close | |
oXl.Quit | |
Set oLogWb = Nothing | |
Set oPersonal = Nothing | |
Set oXl = Nothing | |
Set objShell = Nothing |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment