Article ID: 141759
Article Last Modified on 1/19/2007
119591 How to Obtain Microsoft Support Files from Online Services
Const xlWorkSheet = -4167
Const xl3DPie = -4102
Const xlRows = 1
Set application = CreateObject("Excel.Application")
application.Visible = True
Set workbook = application.Workbooks.Add(template:=xlWorkSheet)
Set worksheet = workbook.Worksheets(1)
worksheet.Range("A1:D1").Value = Array("North", "South", "East", "West")
worksheet.Range("A2").Value = 5.2
worksheet.Range("B2").Value = 10
worksheet.Range("C2").Value = 8
worksheet.Range("D2").Value = 20
Set range = worksheet.Range("A1:D2")
Set chart = workbook.Charts.Add
chart.ChartWizard Source:=range, gallery:=xl3DPie,
Format:=7, plotBy:=xlRows, categoryLabels:=1,
seriesLabels:=0, hasLegend:=2, Title:="Sales Percentages"
workbook.Saved = True
' So that Excel won't ask whether to save this document on close.
112671 OFF: "Built-in Constants in Visual Basic for Applications" (WC0993)
Data Type Variant Constant --------- ---------------- Boolean VT_BOOL Currency (scaled integer) VT_CY Date VT_DATE Error cell values (#N/A, #REF etc.) VT_ERROR Integer VT_I2 Long (long integer) VT_I4 Object VT_DISPATCH Single (single-precision floating-point)VT_R4 Double (double-precision floating-point)VT_R8 String VT_BSTR
Syntax 1
object.Workbooks(index)
Syntax 2
object.Workbooks
VARIANT Application::Workbooks2()
{
VARIANT result;
InvokeHelper(0x23c, DISPATCH_METHOD, VT_VARIANT, (void*)&result, NULL);
return result;
}
Workbooks2 has the same DISPID (0x23c) as Workbooks but does not have
any arguments. This problem cannot be resolved by passing
VT_ERROR/DISP_E_PAMNOTFOUND. All methods marked as having two syntaxes
must be handled in this manner.Additional query words: Excel Automation Controller MFC Client
Keywords: kbdownload kbautomation kbsample KB141759