Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
I need to translate VBA code in an Excel Macro to an VBScript code. Every thing is alright except when I try to make a call to the function PivotCaches.Add(SourceType:=xlExternal). At this step I get an 800A03EE with the ":". Why ??? I have read that some Excel variable are not visible from a VBScript. AM I in this case ? I give my code: Dim xlApp, xlBook, xlSheet, xlChart, xlptCache, xlptTable Dim Db2Id, Db2Prefix, UserId, Password, SqlToExecute Dim RowFieldsToShow, ColumnFieldsToShow, DataToShow Set xlApp = WScript.CreateObject("Excel.Application") xlApp.Visible = True set xlBook = xlApp.Workbooks.Add With xlBook set xlsheet = .sheets.add xlsheet.name = "Data" End With With xlBook.PivotCaches.Add(SourceType:=xlExternal) .Connection = "ODBC;DSN=" & Db2Id & ";UID=" & UserId & ";PWD=" & Password & ";MODE=SHARE;DBALIAS=" & Db2Id & ";" .CommandType = xlCmdSql .CommandText = SQLToExecute .CreatePivotTable TableDestination:="'Data'!R1C1", TableName:="TabXdyn", DefaultVersion:=xlPivotTableVersion10 .Refresh End With With xlptTable.AddFields .RowFields= RowFieldsToShow .ColumnFields=ColumnFieldsToShow With .PivotFields(DataToShow) .Orientation = xlDataField .NumberFormat = "0.00" End With End With I have tried many things but all wrong. If someone has the way to the paradise... Speedking78 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Pivot cache related-- vbscript code | Excel Programming | |||
VBScript to pull html source code | Excel Programming | |||
Can you call VBScript code from VBA? | Excel Programming | |||
VBScript code behind Excel | Excel Programming | |||
PivotCaches.Add | Excel Programming |