CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    May 2001
    Posts
    2

    excel sheet/chart

    i have some excel spreadsheets saved
    from vb, i would like to call the excel chartwizard, make a chart based on this
    excel data, and display it in vb

    also, when i link a spreadsheet, i cannot
    get the entire sheet, and there is no vsb
    shown to view the entire thing


  2. #2
    Join Date
    May 2000
    Location
    New York, NY, USA
    Posts
    2,878

    Re: excel sheet/chart

    Try this VB script. It will build a chart and rotate it.

    ' This sample demonstrates how to access Microsoft Excel using the Windows Scripting Host.

    L_Welcome_MsgBox_Message_Text = "This script demonstrates how to access Excel using the Windows Scripting Host."
    L_Welcome_MsgBox_Title_Text = "Windows Scripting Host Sample"
    Call Welcome()

    ' ********************************************************************************
    ' *
    ' * Excel Sample
    ' *

    Dim objXL
    Dim objXLchart
    Dim intRotate

    Set objXL = WScript.CreateObject("Excel.Application")
    objXL.Workbooks.Add
    objXL.Cells(1,1).Value = 5
    objXL.Cells(1,2).Value = 10
    objXL.Cells(1,3).Value = 15
    objXL.Range("A1:C1").Select

    Set objXLchart = objXL.Charts.Add()
    objXL.Visible = True
    objXLchart.Type = -4100

    For intRotate = 5 To 180 Step 5
    objXLchart.Rotation = intRotate
    Next

    For intRotate = 175 To 0 Step -5
    objXLchart.Rotation = intRotate
    Next

    ' ********************************************************************************
    ' *
    ' * Welcome
    ' *
    Sub Welcome()
    Dim intDoIt

    intDoIt = MsgBox(L_Welcome_MsgBox_Message_Text, _
    vbOKCancel + vbInformation, _
    L_Welcome_MsgBox_Title_Text )
    If intDoIt = vbCancel Then
    WScript.Quit
    End If
    End Sub



    Iouri Boutchkine
    [email protected]
    Iouri Boutchkine
    [email protected]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured