| | |
Please support our Visual Basic 4 / 5 / 6 advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
Join Date: Nov 2006
Posts: 3
Reputation:
Solved Threads: 0
hi again.. i have a problem with excel.. tried to print a chart using excel nia vb but it doesnt work and when it does, it keep producing charts tat are infinity..ALOT OF chart without stopping! HELP!!
Private Sub cmdExcel_Click()
'
'
Dim xlApp As Excel.Application
Dim xlBook As Excel.Workbook
Dim xlSheet As Excel.Worksheet
'Dim xlColumn As Axis
'Dim xlLocationAsObject As Axis
Set xlApp = New Excel.Application
Set xlBook = xlApp.Workbooks.Add
Set xlSheet = xlBook.Worksheets.Add
With xlApp
.Visible = True
' Macro recorded 11/14/2006 by CrashOverride
.Range("A2").Select
.ActiveSheet.Paste
.Range("B2").Select
.ActiveSheet.Paste
.ActiveWindow.SmallScroll Down:=0
.Range("C2").Select
.ActiveSheet.Paste
.ActiveWindow.SmallScroll Down:=-3
.Range("A3:A9").Select
.ActiveWindow.SmallScroll Down:=-9
.Range("A1:C36").Select
.ActiveWindow.SmallScroll Down:=3
.Range("B35").Select
.ActiveCell.FormulaR1C1 = "12.94"
.Range("A1:C36").Select
.Range("C36").Activate
.Charts.Add
.ActiveChart.ChartType = xlLine
.ActiveChart.SetSourceData Source:=Sheets("Sheet1").Range("A1:C36"), PlotBy _
:=xlColumns
.ActiveChart.Location Where:=xlLocationAsObject, Name:="Sheet1"
With ActiveChart
.HasTitle = True
.ChartTitle.Characters.Text = "Assembly Mistakes"
.Axes(xlCategory, xlPrimary).HasTitle = True
.Axes(xlCategory, xlPrimary).AxisTitle.Characters.Text = "No of ribs"
.Axes(xlValue, xlPrimary).HasTitle = True
.Axes(xlValue, xlPrimary).AxisTitle.Characters.Text = "Tolerance"
End With
.ActiveSheet.Shapes("Chart 1").ScaleWidth 1.5, msoFalse, msoScaleFromTopLeft
.ActiveChart.Legend.Select
.Selection.Position = xlBottom
.ActiveChart.Axes(xlValue).Select
.Windows("Book2").SmallScroll Down:=-3
End With
End Sub
Private Sub cmdExcel_Click()
'
'
Dim xlApp As Excel.Application
Dim xlBook As Excel.Workbook
Dim xlSheet As Excel.Worksheet
'Dim xlColumn As Axis
'Dim xlLocationAsObject As Axis
Set xlApp = New Excel.Application
Set xlBook = xlApp.Workbooks.Add
Set xlSheet = xlBook.Worksheets.Add
With xlApp
.Visible = True
' Macro recorded 11/14/2006 by CrashOverride
.Range("A2").Select
.ActiveSheet.Paste
.Range("B2").Select
.ActiveSheet.Paste
.ActiveWindow.SmallScroll Down:=0
.Range("C2").Select
.ActiveSheet.Paste
.ActiveWindow.SmallScroll Down:=-3
.Range("A3:A9").Select
.ActiveWindow.SmallScroll Down:=-9
.Range("A1:C36").Select
.ActiveWindow.SmallScroll Down:=3
.Range("B35").Select
.ActiveCell.FormulaR1C1 = "12.94"
.Range("A1:C36").Select
.Range("C36").Activate
.Charts.Add
.ActiveChart.ChartType = xlLine
.ActiveChart.SetSourceData Source:=Sheets("Sheet1").Range("A1:C36"), PlotBy _
:=xlColumns
.ActiveChart.Location Where:=xlLocationAsObject, Name:="Sheet1"
With ActiveChart
.HasTitle = True
.ChartTitle.Characters.Text = "Assembly Mistakes"
.Axes(xlCategory, xlPrimary).HasTitle = True
.Axes(xlCategory, xlPrimary).AxisTitle.Characters.Text = "No of ribs"
.Axes(xlValue, xlPrimary).HasTitle = True
.Axes(xlValue, xlPrimary).AxisTitle.Characters.Text = "Tolerance"
End With
.ActiveSheet.Shapes("Chart 1").ScaleWidth 1.5, msoFalse, msoScaleFromTopLeft
.ActiveChart.Legend.Select
.Selection.Position = xlBottom
.ActiveChart.Axes(xlValue).Select
.Windows("Book2").SmallScroll Down:=-3
End With
End Sub
![]() |
Similar Threads
- Excel to Web in Real Time? (ASP)
- How to write files to an Excel application (Visual Basic 4 / 5 / 6)
- grabbing source from excel file (was: please, somebody help me!!!) (Visual Basic 4 / 5 / 6)
- Macros in Excel (Visual Basic 4 / 5 / 6)
- Visual C++ and Excel (C++)
Other Threads in the Visual Basic 4 / 5 / 6 Forum
- Previous Thread: Connect to PHP
- Next Thread: Auto-resizing images in the IE Browser control
| Thread Tools | Search this Thread |
* 6 429 2007 access activex add age append application basic beginner birth bmp calculator cd cells.find click client code college column component connection connectionproblemusingvb6usingoledb copy creat ctrl+f data database datareport date delete dissertations dissertationthesis dissertationtopic edit error excel excelmacro file filename form hardware header iamthwee image inboxinvb internetfiledownload keypress label listbox listview liveperson login looping machine microsoft movingranges number objectinsert open oracle password prime program prompt range-objects readfile reading record refresh remotesqlserverdatabase report retrieve save search sendbyte sites sort sql sql2008 sqlserver subroutine table tags textbox time urldownloadtofile vb vb6 vb6.0 vba visual visualbasic visualbasic6 web window windows





