home *** CD-ROM | disk | FTP | other *** search
/ An Introduction to Progr…l Basic 6.0 (4th Edition) / An Introduction to Programming using Visual Basic 6.0.iso / PROGRAMS / CH14 / 14-1-1.FRM (.txt) next >
Encoding:
Visual Basic Form  |  1998-10-05  |  4.7 KB  |  156 lines

  1. VERSION 5.00
  2. Begin VB.Form frm14_1_1 
  3.    Caption         =   "College Expenses"
  4.    ClientHeight    =   3240
  5.    ClientLeft      =   1140
  6.    ClientTop       =   1512
  7.    ClientWidth     =   3192
  8.    LinkTopic       =   "Form1"
  9.    PaletteMode     =   1  'UseZOrder
  10.    ScaleHeight     =   3240
  11.    ScaleWidth      =   3192
  12.    Begin VB.TextBox txtOther 
  13.       Height          =   285
  14.       Left            =   1680
  15.       TabIndex        =   11
  16.       Top             =   1560
  17.       Width           =   1455
  18.    End
  19.    Begin VB.TextBox txtTransportation 
  20.       Height          =   285
  21.       Left            =   1680
  22.       TabIndex        =   10
  23.       Top             =   1200
  24.       Width           =   1455
  25.    End
  26.    Begin VB.TextBox txtBoard 
  27.       Height          =   285
  28.       Left            =   1680
  29.       TabIndex        =   9
  30.       Top             =   840
  31.       Width           =   1455
  32.    End
  33.    Begin VB.TextBox txtBooksNSuppl 
  34.       Height          =   285
  35.       Left            =   1680
  36.       TabIndex        =   8
  37.       Top             =   480
  38.       Width           =   1455
  39.    End
  40.    Begin VB.TextBox txtTuitNFees 
  41.       Height          =   285
  42.       Left            =   1680
  43.       TabIndex        =   7
  44.       Top             =   120
  45.       Width           =   1455
  46.    End
  47.    Begin VB.CommandButton cmdQuit 
  48.       Caption         =   "&Quit"
  49.       Height          =   495
  50.       Left            =   2400
  51.       TabIndex        =   1
  52.       Top             =   2640
  53.       Width           =   732
  54.    End
  55.    Begin VB.CommandButton cmdCalculate 
  56.       Caption         =   "&Calculate Total Expenses"
  57.       Height          =   495
  58.       Left            =   120
  59.       TabIndex        =   0
  60.       Top             =   2640
  61.       Width           =   2052
  62.    End
  63.    Begin VB.Label lblHoldTotal 
  64.       BorderStyle     =   1  'Fixed Single
  65.       Height          =   255
  66.       Left            =   1680
  67.       TabIndex        =   13
  68.       Top             =   2280
  69.       Width           =   1455
  70.    End
  71.    Begin VB.Label lblTotal 
  72.       Caption         =   "TOTAL:"
  73.       Height          =   255
  74.       Left            =   960
  75.       TabIndex        =   12
  76.       Top             =   2280
  77.       Width           =   615
  78.    End
  79.    Begin VB.Line Line1 
  80.       X1              =   360
  81.       X2              =   3120
  82.       Y1              =   2040
  83.       Y2              =   2040
  84.    End
  85.    Begin VB.Label lblOther 
  86.       Caption         =   "Other Expenses"
  87.       Height          =   255
  88.       Left            =   360
  89.       TabIndex        =   6
  90.       Top             =   1560
  91.       Width           =   1215
  92.    End
  93.    Begin VB.Label lblTransportation 
  94.       Caption         =   "Transportation"
  95.       Height          =   255
  96.       Left            =   480
  97.       TabIndex        =   5
  98.       Top             =   1200
  99.       Width           =   1095
  100.    End
  101.    Begin VB.Label lblBoard 
  102.       Caption         =   "Board"
  103.       Height          =   255
  104.       Left            =   1080
  105.       TabIndex        =   4
  106.       Top             =   840
  107.       Width           =   495
  108.    End
  109.    Begin VB.Label lblBooksNSuppl 
  110.       Caption         =   "Books and Supplies"
  111.       Height          =   255
  112.       Left            =   120
  113.       TabIndex        =   3
  114.       Top             =   480
  115.       Width           =   1455
  116.    End
  117.    Begin VB.Label lblTuitNFees 
  118.       Caption         =   "Tuition and Fees"
  119.       Height          =   255
  120.       Left            =   360
  121.       TabIndex        =   2
  122.       Top             =   120
  123.       Width           =   1215
  124.    End
  125. Attribute VB_Name = "frm14_1_1"
  126. Attribute VB_GlobalNameSpace = False
  127. Attribute VB_Creatable = False
  128. Attribute VB_PredeclaredId = True
  129. Attribute VB_Exposed = False
  130. Dim objExcel As Object
  131. Private Sub cmdCalculate_Click()
  132.   Set objExcel = CreateObject("Excel.Sheet")
  133.   'Make Excel visible
  134.   objExcel.Application.Visible = True
  135.   'Fill in Rows Values
  136.   objExcel.Application.Cells(1, 3).Value = txtTuitNFees.Text
  137.   objExcel.Application.Cells(2, 3).Value = txtBooksNSuppl.Text
  138.   objExcel.Application.Cells(3, 3).Value = txtBoard.Text
  139.   objExcel.Application.Cells(4, 3).Value = txtTransportation.Text
  140.   objExcel.Application.Cells(5, 3).Value = txtOther.Text
  141.   objExcel.Application.Cells(6, 3).Font.Bold = True
  142.   'Set up a cell to total the expenses
  143.   objExcel.Application.Cells(6, 1).Formula = "=SUM(C1:C5)"
  144.   'Set total as the contents of this cell
  145.   lblHoldTotal = objExcel.Application.Cells(6, 1).Value
  146.   'Make Excel invisible
  147.   objExcel.Application.Visible = False
  148. End Sub
  149. Private Sub cmdQuit_Click()
  150.   'Close Excel
  151.   objExcel.Application.Quit
  152.   'Release the object variable
  153.   Set objExcel = Nothing
  154.   End
  155. End Sub
  156.