home *** CD-ROM | disk | FTP | other *** search
/ Planet Source Code Jumbo …e CD Visual Basic 1 to 7 / 1_2002.ISO / Data / Zips / rcs1949272701012001.psc / frmMain.frm (.txt) next >
Encoding:
Visual Basic Form  |  2001-10-01  |  53.7 KB  |  1,705 lines

  1. VERSION 5.00
  2. Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "COMDLG32.OCX"
  3. Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
  4. Object = "{5E9E78A0-531B-11CF-91F6-C2863C385E30}#1.0#0"; "MSFLXGRD.OCX"
  5. Begin VB.Form frmMain 
  6.    Caption         =   "XL Grid"
  7.    ClientHeight    =   4065
  8.    ClientLeft      =   165
  9.    ClientTop       =   735
  10.    ClientWidth     =   8415
  11.    LinkTopic       =   "Form1"
  12.    ScaleHeight     =   4065
  13.    ScaleWidth      =   8415
  14.    StartUpPosition =   3  'Windows Default
  15.    Begin VB.Frame frFonts 
  16.       BorderStyle     =   0  'None
  17.       Height          =   492
  18.       Left            =   0
  19.       TabIndex        =   13
  20.       Top             =   840
  21.       Width           =   6732
  22.       Begin VB.ComboBox cmbFunc 
  23.          Height          =   288
  24.          Left            =   4680
  25.          Sorted          =   -1  'True
  26.          TabIndex        =   18
  27.          Top             =   120
  28.          Width           =   1572
  29.       End
  30.       Begin VB.ComboBox cmbFontSize 
  31.          Height          =   288
  32.          Left            =   2640
  33.          TabIndex        =   16
  34.          Top             =   120
  35.          Width           =   732
  36.       End
  37.       Begin VB.ComboBox cmbFonts 
  38.          Height          =   288
  39.          Left            =   600
  40.          TabIndex        =   14
  41.          Top             =   120
  42.          Width           =   1692
  43.       End
  44.       Begin VB.Label lblFormat 
  45.          Alignment       =   1  'Right Justify
  46.          AutoSize        =   -1  'True
  47.          Caption         =   "Valid Functions"
  48.          Height          =   192
  49.          Left            =   3480
  50.          TabIndex        =   17
  51.          Top             =   120
  52.          Width           =   1092
  53.       End
  54.       Begin VB.Label Label4 
  55.          Alignment       =   2  'Center
  56.          AutoSize        =   -1  'True
  57.          Caption         =   "Font"
  58.          Height          =   192
  59.          Left            =   144
  60.          TabIndex        =   15
  61.          Top             =   120
  62.          Width           =   324
  63.       End
  64.    End
  65.    Begin MSComctlLib.ImageList ImageList1 
  66.       Left            =   840
  67.       Top             =   2760
  68.       _ExtentX        =   794
  69.       _ExtentY        =   794
  70.       BackColor       =   -2147483643
  71.       ImageWidth      =   32
  72.       ImageHeight     =   32
  73.       MaskColor       =   12632256
  74.       _Version        =   393216
  75.       BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628} 
  76.          NumListImages   =   2
  77.          BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  78.             Picture         =   "frmMain.frx":0000
  79.             Key             =   ""
  80.          EndProperty
  81.          BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  82.             Picture         =   "frmMain.frx":0454
  83.             Key             =   ""
  84.          EndProperty
  85.       EndProperty
  86.    End
  87.    Begin VB.Frame Frame 
  88.       BorderStyle     =   0  'None
  89.       Height          =   492
  90.       Left            =   0
  91.       TabIndex        =   3
  92.       Top             =   360
  93.       Width           =   7815
  94.       Begin VB.CommandButton Command2 
  95.          Enabled         =   0   'False
  96.          Height          =   252
  97.          Left            =   7200
  98.          Picture         =   "frmMain.frx":08A8
  99.          Style           =   1  'Graphical
  100.          TabIndex        =   11
  101.          Top             =   120
  102.          Width           =   492
  103.       End
  104.       Begin VB.CommandButton Command1 
  105.          Enabled         =   0   'False
  106.          Height          =   252
  107.          Left            =   6600
  108.          Picture         =   "frmMain.frx":0CEA
  109.          Style           =   1  'Graphical
  110.          TabIndex        =   10
  111.          Top             =   120
  112.          Width           =   492
  113.       End
  114.       Begin VB.TextBox txtFormula 
  115.          Height          =   288
  116.          Left            =   3960
  117.          TabIndex        =   9
  118.          Top             =   120
  119.          Width           =   2535
  120.       End
  121.       Begin VB.TextBox txtCellVal 
  122.          Height          =   288
  123.          Left            =   2280
  124.          TabIndex        =   7
  125.          Top             =   120
  126.          Width           =   1212
  127.       End
  128.       Begin VB.TextBox txtRowCol 
  129.          Height          =   288
  130.          Left            =   720
  131.          TabIndex        =   4
  132.          Top             =   120
  133.          Width           =   852
  134.       End
  135.       Begin VB.Label Label3 
  136.          Alignment       =   2  'Center
  137.          Caption         =   "="
  138.          BeginProperty Font 
  139.             Name            =   "MS Sans Serif"
  140.             Size            =   13.5
  141.             Charset         =   0
  142.             Weight          =   400
  143.             Underline       =   0   'False
  144.             Italic          =   0   'False
  145.             Strikethrough   =   0   'False
  146.          EndProperty
  147.          Height          =   372
  148.          Left            =   3600
  149.          TabIndex        =   8
  150.          Top             =   120
  151.          Width           =   252
  152.       End
  153.       Begin VB.Label Label2 
  154.          Alignment       =   2  'Center
  155.          Caption         =   "Value"
  156.          Height          =   372
  157.          Left            =   1680
  158.          TabIndex        =   6
  159.          Top             =   120
  160.          Width           =   612
  161.       End
  162.       Begin VB.Label Label1 
  163.          Alignment       =   2  'Center
  164.          Caption         =   "Cell"
  165.          Height          =   852
  166.          Left            =   -120
  167.          TabIndex        =   5
  168.          Top             =   120
  169.          Width           =   732
  170.       End
  171.    End
  172.    Begin MSFlexGridLib.MSFlexGrid GrdSheet 
  173.       Height          =   1812
  174.       Left            =   120
  175.       TabIndex        =   2
  176.       Top             =   1920
  177.       Width           =   6612
  178.       _ExtentX        =   11668
  179.       _ExtentY        =   3201
  180.       _Version        =   393216
  181.       Rows            =   10
  182.       Cols            =   10
  183.       BackColor       =   12648447
  184.       ScrollTrack     =   -1  'True
  185.       AllowUserResizing=   3
  186.       BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  187.          Name            =   "MS Sans Serif"
  188.          Size            =   8.25
  189.          Charset         =   0
  190.          Weight          =   400
  191.          Underline       =   0   'False
  192.          Italic          =   0   'False
  193.          Strikethrough   =   0   'False
  194.       EndProperty
  195.    End
  196.    Begin MSComDlg.CommonDialog dlgDlg 
  197.       Left            =   0
  198.       Top             =   1440
  199.       _ExtentX        =   688
  200.       _ExtentY        =   688
  201.       _Version        =   393216
  202.    End
  203.    Begin MSComctlLib.StatusBar sbStatusBar 
  204.       Align           =   2  'Align Bottom
  205.       Height          =   270
  206.       Left            =   0
  207.       TabIndex        =   0
  208.       Top             =   3795
  209.       Width           =   8415
  210.       _ExtentX        =   14843
  211.       _ExtentY        =   476
  212.       _Version        =   393216
  213.       BeginProperty Panels {8E3867A5-8586-11D1-B16A-00C0F0283628} 
  214.          NumPanels       =   3
  215.          BeginProperty Panel1 {8E3867AB-8586-11D1-B16A-00C0F0283628} 
  216.             AutoSize        =   1
  217.             Object.Width           =   9208
  218.             Text            =   "Status"
  219.             TextSave        =   "Status"
  220.          EndProperty
  221.          BeginProperty Panel2 {8E3867AB-8586-11D1-B16A-00C0F0283628} 
  222.             Style           =   6
  223.             AutoSize        =   2
  224.             TextSave        =   "10/1/01"
  225.          EndProperty
  226.          BeginProperty Panel3 {8E3867AB-8586-11D1-B16A-00C0F0283628} 
  227.             Style           =   5
  228.             AutoSize        =   2
  229.             TextSave        =   "11:43 AM"
  230.          EndProperty
  231.       EndProperty
  232.    End
  233.    Begin MSComctlLib.ImageList imlToolbarIcons 
  234.       Left            =   3480
  235.       Top             =   2880
  236.       _ExtentX        =   794
  237.       _ExtentY        =   794
  238.       BackColor       =   -2147483643
  239.       ImageWidth      =   16
  240.       ImageHeight     =   16
  241.       MaskColor       =   12632256
  242.       _Version        =   393216
  243.       BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628} 
  244.          NumListImages   =   13
  245.          BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  246.             Picture         =   "frmMain.frx":112C
  247.             Key             =   "New"
  248.          EndProperty
  249.          BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  250.             Picture         =   "frmMain.frx":123E
  251.             Key             =   "Open"
  252.          EndProperty
  253.          BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  254.             Picture         =   "frmMain.frx":1350
  255.             Key             =   "Save"
  256.          EndProperty
  257.          BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  258.             Picture         =   "frmMain.frx":1462
  259.             Key             =   "Print"
  260.          EndProperty
  261.          BeginProperty ListImage5 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  262.             Picture         =   "frmMain.frx":1574
  263.             Key             =   "Cut"
  264.          EndProperty
  265.          BeginProperty ListImage6 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  266.             Picture         =   "frmMain.frx":1686
  267.             Key             =   "Copy"
  268.          EndProperty
  269.          BeginProperty ListImage7 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  270.             Picture         =   "frmMain.frx":1798
  271.             Key             =   "Paste"
  272.          EndProperty
  273.          BeginProperty ListImage8 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  274.             Picture         =   "frmMain.frx":18AA
  275.             Key             =   "Bold"
  276.          EndProperty
  277.          BeginProperty ListImage9 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  278.             Picture         =   "frmMain.frx":19BC
  279.             Key             =   "Italic"
  280.          EndProperty
  281.          BeginProperty ListImage10 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  282.             Picture         =   "frmMain.frx":1ACE
  283.             Key             =   "Underline"
  284.          EndProperty
  285.          BeginProperty ListImage11 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  286.             Picture         =   "frmMain.frx":1BE0
  287.             Key             =   "Align Left"
  288.          EndProperty
  289.          BeginProperty ListImage12 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  290.             Picture         =   "frmMain.frx":1CF2
  291.             Key             =   "Center"
  292.          EndProperty
  293.          BeginProperty ListImage13 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  294.             Picture         =   "frmMain.frx":1E04
  295.             Key             =   "Align Right"
  296.          EndProperty
  297.       EndProperty
  298.    End
  299.    Begin MSComctlLib.Toolbar tbToolBar 
  300.       Align           =   1  'Align Top
  301.       Height          =   420
  302.       Left            =   0
  303.       TabIndex        =   1
  304.       Top             =   0
  305.       Width           =   8415
  306.       _ExtentX        =   14843
  307.       _ExtentY        =   741
  308.       ButtonWidth     =   609
  309.       ButtonHeight    =   582
  310.       Appearance      =   1
  311.       ImageList       =   "imlToolbarIcons"
  312.       _Version        =   393216
  313.       BeginProperty Buttons {66833FE8-8583-11D1-B16A-00C0F0283628} 
  314.          NumButtons      =   17
  315.          BeginProperty Button1 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  316.             Key             =   "New"
  317.             Object.ToolTipText     =   "New"
  318.             ImageKey        =   "New"
  319.          EndProperty
  320.          BeginProperty Button2 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  321.             Key             =   "Open"
  322.             Object.ToolTipText     =   "Open"
  323.             ImageKey        =   "Open"
  324.          EndProperty
  325.          BeginProperty Button3 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  326.             Key             =   "Save"
  327.             Object.ToolTipText     =   "Save"
  328.             ImageKey        =   "Save"
  329.          EndProperty
  330.          BeginProperty Button4 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  331.             Style           =   3
  332.          EndProperty
  333.          BeginProperty Button5 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  334.             Key             =   "Print"
  335.             Object.ToolTipText     =   "Print"
  336.             ImageKey        =   "Print"
  337.          EndProperty
  338.          BeginProperty Button6 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  339.             Style           =   3
  340.          EndProperty
  341.          BeginProperty Button7 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  342.             Key             =   "Cut"
  343.             Object.ToolTipText     =   "Cut"
  344.             ImageKey        =   "Cut"
  345.          EndProperty
  346.          BeginProperty Button8 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  347.             Key             =   "Copy"
  348.             Object.ToolTipText     =   "Copy"
  349.             ImageKey        =   "Copy"
  350.          EndProperty
  351.          BeginProperty Button9 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  352.             Key             =   "Paste"
  353.             Object.ToolTipText     =   "Paste to any application"
  354.             ImageKey        =   "Paste"
  355.          EndProperty
  356.          BeginProperty Button10 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  357.             Style           =   3
  358.          EndProperty
  359.          BeginProperty Button11 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  360.             Key             =   "Bold"
  361.             Object.ToolTipText     =   "Bold"
  362.             ImageKey        =   "Bold"
  363.             Style           =   1
  364.          EndProperty
  365.          BeginProperty Button12 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  366.             Key             =   "Italic"
  367.             Object.ToolTipText     =   "Italic"
  368.             ImageKey        =   "Italic"
  369.             Style           =   1
  370.          EndProperty
  371.          BeginProperty Button13 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  372.             Key             =   "Underline"
  373.             Object.ToolTipText     =   "Underline"
  374.             ImageKey        =   "Underline"
  375.             Style           =   1
  376.          EndProperty
  377.          BeginProperty Button14 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  378.             Style           =   3
  379.          EndProperty
  380.          BeginProperty Button15 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  381.             Key             =   "Align Left"
  382.             Object.ToolTipText     =   "Align Left"
  383.             ImageKey        =   "Align Left"
  384.             Style           =   2
  385.          EndProperty
  386.          BeginProperty Button16 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  387.             Key             =   "Center"
  388.             Object.ToolTipText     =   "Center"
  389.             ImageKey        =   "Center"
  390.             Style           =   2
  391.          EndProperty
  392.          BeginProperty Button17 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  393.             Key             =   "Align Right"
  394.             Object.ToolTipText     =   "Align Right"
  395.             ImageKey        =   "Align Right"
  396.             Style           =   2
  397.          EndProperty
  398.       EndProperty
  399.       Begin VB.TextBox txtDim 
  400.          Height          =   288
  401.          Left            =   5160
  402.          TabIndex        =   12
  403.          Top             =   0
  404.          Width           =   2532
  405.       End
  406.    End
  407.    Begin VB.Menu mnuFile 
  408.       Caption         =   "&File"
  409.       Begin VB.Menu mnuFileNew 
  410.          Caption         =   "&New"
  411.          Shortcut        =   ^N
  412.       End
  413.       Begin VB.Menu mnuFileOpen 
  414.          Caption         =   "&Open..."
  415.          Begin VB.Menu mnuText 
  416.             Caption         =   "Text file"
  417.          End
  418.          Begin VB.Menu mnuGrd 
  419.             Caption         =   "Grd File"
  420.          End
  421.       End
  422.       Begin VB.Menu mnuFileClose 
  423.          Caption         =   "&Close"
  424.          Visible         =   0   'False
  425.       End
  426.       Begin VB.Menu mnuFileBar0 
  427.          Caption         =   "-"
  428.       End
  429.       Begin VB.Menu mnuFileSave 
  430.          Caption         =   "&Save"
  431.          Begin VB.Menu mnuSaveTxt 
  432.             Caption         =   "As Text"
  433.          End
  434.          Begin VB.Menu mnuSaveGrd 
  435.             Caption         =   "As Grd"
  436.          End
  437.          Begin VB.Menu mnuSaveExl 
  438.             Caption         =   "As Excel"
  439.          End
  440.       End
  441.       Begin VB.Menu mnuFileSaveAs 
  442.          Caption         =   "Save &As..."
  443.          Visible         =   0   'False
  444.       End
  445.       Begin VB.Menu mnuFileSaveAll 
  446.          Caption         =   "Save A&ll"
  447.          Visible         =   0   'False
  448.       End
  449.       Begin VB.Menu mnuFileBar1 
  450.          Caption         =   "-"
  451.       End
  452.       Begin VB.Menu mnuFileProperties 
  453.          Caption         =   "Propert&ies"
  454.          Visible         =   0   'False
  455.       End
  456.       Begin VB.Menu mnuFileBar2 
  457.          Caption         =   "-"
  458.          Visible         =   0   'False
  459.       End
  460.       Begin VB.Menu mnuFilePageSetup 
  461.          Caption         =   "Page Set&up..."
  462.          Visible         =   0   'False
  463.       End
  464.       Begin VB.Menu mnuFilePrintPreview 
  465.          Caption         =   "Print Pre&view"
  466.          Visible         =   0   'False
  467.       End
  468.       Begin VB.Menu mnuFilePrint 
  469.          Caption         =   "&Print..."
  470.       End
  471.       Begin VB.Menu mnuFileBar3 
  472.          Caption         =   "-"
  473.       End
  474.       Begin VB.Menu mnuFileSend 
  475.          Caption         =   "Sen&d..."
  476.          Visible         =   0   'False
  477.       End
  478.       Begin VB.Menu mnuFileBar4 
  479.          Caption         =   "-"
  480.          Visible         =   0   'False
  481.       End
  482.       Begin VB.Menu mnuFileMRU 
  483.          Caption         =   ""
  484.          Index           =   1
  485.          Visible         =   0   'False
  486.       End
  487.       Begin VB.Menu mnuFileMRU 
  488.          Caption         =   ""
  489.          Index           =   2
  490.          Visible         =   0   'False
  491.       End
  492.       Begin VB.Menu mnuFileMRU 
  493.          Caption         =   ""
  494.          Index           =   3
  495.          Visible         =   0   'False
  496.       End
  497.       Begin VB.Menu mnuFileBar5 
  498.          Caption         =   "-"
  499.          Visible         =   0   'False
  500.       End
  501.       Begin VB.Menu mnuFileExit 
  502.          Caption         =   "E&xit"
  503.       End
  504.    End
  505.    Begin VB.Menu mnuEdit 
  506.       Caption         =   "&Edit"
  507.       Begin VB.Menu mnuEditUndo 
  508.          Caption         =   "&Undo"
  509.          Visible         =   0   'False
  510.       End
  511.       Begin VB.Menu mnuEditCut 
  512.          Caption         =   "Cu&t"
  513.          Shortcut        =   ^X
  514.       End
  515.       Begin VB.Menu mnuEditCopy 
  516.          Caption         =   "&Copy"
  517.          Shortcut        =   ^C
  518.       End
  519.       Begin VB.Menu mnuEditCopyFormula 
  520.          Caption         =   "Copy &Formula"
  521.       End
  522.       Begin VB.Menu mnuViewBar0 
  523.          Caption         =   "-"
  524.       End
  525.       Begin VB.Menu mnuEditPaste 
  526.          Caption         =   "&Paste"
  527.          Shortcut        =   ^V
  528.       End
  529.       Begin VB.Menu mnuEditPasteSpecial 
  530.          Caption         =   "Paste &Formula..."
  531.       End
  532.       Begin VB.Menu mnuEditBar0 
  533.          Caption         =   "-"
  534.       End
  535.       Begin VB.Menu mnuResize 
  536.          Caption         =   "Resize &Sheet"
  537.       End
  538.       Begin VB.Menu mnuRowCol 
  539.          Caption         =   "&Rows && Cols"
  540.       End
  541.    End
  542.    Begin VB.Menu mnuView 
  543.       Caption         =   "&View"
  544.       Begin VB.Menu mnuViewToolbar 
  545.          Caption         =   "&Toolbar"
  546.          Checked         =   -1  'True
  547.       End
  548.       Begin VB.Menu mnuViewStatusBar 
  549.          Caption         =   "Status &Bar"
  550.          Checked         =   -1  'True
  551.       End
  552.       Begin VB.Menu mnuViewRefresh 
  553.          Caption         =   "&Refresh"
  554.          Visible         =   0   'False
  555.       End
  556.       Begin VB.Menu mnuViewWebBrowser 
  557.          Caption         =   "&Web Browser"
  558.          Visible         =   0   'False
  559.       End
  560.    End
  561.    Begin VB.Menu mnuViewOptions 
  562.       Caption         =   "&Format "
  563.       Begin VB.Menu mnuAutoFormat 
  564.          Caption         =   "&Auto Format"
  565.          Checked         =   -1  'True
  566.       End
  567.       Begin VB.Menu mnuFormatCell 
  568.          Caption         =   "&Cell"
  569.       End
  570.       Begin VB.Menu mnuFormatRow 
  571.          Caption         =   "&Row"
  572.       End
  573.       Begin VB.Menu mnuFormatCol 
  574.          Caption         =   "&Col"
  575.       End
  576.    End
  577.    Begin VB.Menu mnuHelp 
  578.       Caption         =   "&Help"
  579.       Begin VB.Menu mnuHelpContents 
  580.          Caption         =   "&Contents"
  581.          Visible         =   0   'False
  582.       End
  583.       Begin VB.Menu mnuHelpSearchForHelpOn 
  584.          Caption         =   "&Search For Help On..."
  585.          Shortcut        =   {F1}
  586.       End
  587.       Begin VB.Menu mnuHelpBar0 
  588.          Caption         =   "-"
  589.          Visible         =   0   'False
  590.       End
  591.       Begin VB.Menu mnuHelpAbout 
  592.          Caption         =   "&About "
  593.       End
  594.    End
  595. Attribute VB_Name = "frmMain"
  596. Attribute VB_GlobalNameSpace = False
  597. Attribute VB_Creatable = False
  598. Attribute VB_PredeclaredId = True
  599. Attribute VB_Exposed = False
  600. Dim myExcelFile As New ExcelFile
  601. Dim formulaCopy
  602. Dim AutoForm As Boolean
  603. Private Declare Function OSWinHelp% Lib "user32" Alias "WinHelpA" (ByVal hwnd&, ByVal HelpFile$, ByVal wCommand%, dwData As Any)
  604. Private Sub cmbFonts_Click()
  605. GrdSheet.CellFontName = cmbFonts.Text
  606. GrdSheet.SetFocus
  607. End Sub
  608. Private Sub cmbFontSize_Click()
  609. GrdSheet.CellFontSize = cmbFontSize.Text
  610. GrdSheet.SetFocus
  611. End Sub
  612. Private Sub cmbFunc_Click()
  613. txt = "Syntax  "
  614. Select Case UCase(cmbFunc.Text)
  615.    Case "("
  616.       txt = ""
  617.    Case "-"
  618.    txt = ""
  619.    Case "NOT"
  620.      txt = txt + "Expression1= NOT Expression2"
  621.    Case ","
  622.      txt = ""
  623.    Case ")"
  624.      txt = ""
  625.    Case "^"
  626.    txt = txt + "num1 ^ num2"
  627.    Case "*"
  628.      txt = txt + "num1 * num2"
  629.    Case "/"
  630.         txt = txt + "num1 / num2"
  631.    Case "\"
  632.      txt = txt + " num1 \ num2   This is Integer division"
  633.    Case "MOD"
  634.      txt = txt + "num1 MOD num2"
  635.    Case "+"
  636.    txt = txt + "num1 + num2"
  637.    Case "-"
  638.      txt = txt + "num1 - num2"
  639.    Case "="
  640.      txt = ""
  641.    Case "<"
  642.      txt = txt + "expression1 < expression2"
  643.    Case "<="
  644.      txt = txt + "expression1 <= expression2"
  645.    Case ">"
  646.      txt = txt + "expression1 > expression2"
  647.    Case ">="
  648.      txt = txt + "expression1 >= expression2"
  649.    Case "<>"
  650.      txt = txt + "expression1 <> expression2"
  651.    Case "AND"
  652.      txt = txt + "expression1 AND expression2  BOOLEAN"
  653.    Case "OR"
  654.      txt = txt + "expression1 OR expression2   BOOLEAN"
  655.    Case "XOR"
  656.      txt = txt + "expression1 XOR expression2   BOOLEAN"
  657.    Case "PI"
  658.      txt = "Insrts the value of PI= 3.14159265358979"
  659.    Case "DEG"
  660.       txt = txt + "DEG(num) RETURNS THE GEGREES IN num"
  661.    Case "RAD"
  662.       txt = txt + "RAD(num) RETURNS THE RADIANS IN num"
  663.    Case "ABS"
  664.    txt = txt + "ABS(num)  Absolute value"
  665.    Case "INT"
  666.    txt = txt + "INT(num) Integer value"
  667. Case "FIX"
  668.    Case "SGN"
  669.    txt = txt + "SGN(num)  Sign of num"
  670.    Case "SQR"
  671.    txt = txt + "SQR(num) Square root of +num"
  672.   Case "LOG"
  673.   txt = txt + "LOG(num) Common log of num"
  674.      Case "LN"
  675.      txt = txt + "DEG(num) Natural log of num num"
  676.     Case "EXP"
  677.       txt = txt + "exp(num)"
  678.     Case "SIN"
  679.     txt = txt + "SIN(num in radians)"
  680.     Case "ASIN"
  681.         txt = txt + "ASIN(num) returns the angle in radians"
  682.     Case "COS"
  683.       txt = txt + "COS(num in radians)"
  684.     Case "ACOS"
  685.        txt = txt + "ACOS(num) returns the angle in radians"
  686.     Case "TAN"
  687.      txt = txt + "TAN(num in radians)"
  688.    Case "ATN"
  689.      txt = txt + "ATN(num) returns the angle in radians"
  690.    Case "ATAN"
  691.     txt = txt + "ATN(num) returns the angle in radians"
  692.     Case "SEC"
  693.       txt = txt + "SEC(num in radians)"
  694.     Case "CSC"
  695.        txt = txt + "CSC(num in radians)"
  696.     Case "COT"
  697.     txt = txt + "COT(num in radians)"
  698.     Case "SIN_D"
  699.     txt = txt + "SIN_D(num in degrees)"
  700.    Case "COS_D"
  701.        txt = txt + "COS_D(num in degrees)"
  702.      Case "TAN_D"
  703.        txt = txt + "TAN_D(num in degrees)"
  704.    Case "POWER"
  705.          txt = txt + "(POWER(num1,num2) RETURNS num1 to power num2"
  706.     Case "MIN", "MAX"
  707.     txt = txt + "MAX/MIN (exp1,exp2)"
  708.     Case "&"
  709.     txt = txt + "String1 & string2"
  710.     Case "LEN"
  711.     txt = txt + "LEN(string) length of string"
  712.     Case "ASC"
  713.     txt = txt + "ASC(string) ASCII of first character of string)"
  714.     Case "SPACE"
  715.     txt = txt + "SPACE(num)  insert num spaces"
  716.     Case "LEFT", "RIGHT"
  717.     txt = txt + "LEFT/RIGHT(string ,n) left/right n chars"
  718.     Case "MID"
  719.     txt = txt + "MID(string, start[, n] n chars from start)"
  720.     Case "INSTR"
  721.     txt = txt + "INSTR(string1,string2) location of string2 in string1"
  722.     Case "GAMMA"
  723.     txt = txt + "GAMMA(x)  Returns the Gamma of x"
  724.     Case "SINH"
  725.     txt = txt + "SINH(x)  Returns hyperbolic sine"
  726.     Case "COSH"
  727.     txt = txt + "COSH(x)  Returns hyperbolic co-sine"
  728.     Case "TANH"
  729.     txt = txt + "TANH(x)   Returns the hyperbolic Tan of x"
  730.     Case "SUMABOVE"
  731.     txt = txt + "Returns the sum of numerical values of the cells above"
  732.     Case "ASINH"
  733.     txt = txt + "ASINH(x)  Returns Inverse Hyperbolic sine of x"
  734.     Case "ACOSH"
  735.     txt = txt + "ASINH(x)  Returns Inverse Hyperbolic Co-sine of x"
  736.     Case Else
  737.        txt = ""
  738.    End Select
  739. txtFormula.Text = txtFormula.Text + cmbFunc.Text
  740. cmbFunc.ToolTipText = txt
  741. End Sub
  742. Private Sub Command1_Click()
  743. GrdSheet.SetFocus
  744. On Error GoTo prnError
  745. Dim expr As New CExpression
  746. txt = Right(txtFormula, Len(txtFormula.Text) - 1)
  747.    If UCase(txt) = "SUMABOVE" Then
  748.    Thisrow = GrdSheet.row
  749.    If Thisrow = GrdSheet.FixedRows Then
  750.       txtFormula.Text = ""
  751.       formula(GrdSheet.row, GrdSheet.col) = ""
  752.         Exit Sub
  753.        End If
  754.      For i = Thisrow - 1 To GrdSheet.FixedRows Step -1
  755.        GrdSheet.row = i
  756.        Sum = Sum + Val(GrdSheet)
  757.      Next
  758.      GrdSheet.row = Thisrow
  759.      GrdSheet = Sum
  760.       
  761. Exit Sub
  762. End If
  763. If Len(txt) > 200 Then
  764.     MsgBox "Expression cannot have more than 200 characters"
  765.     Exit Sub
  766.     End If
  767. expr.Expression = txt
  768.       If expr.ErrorCode Then
  769.           MsgBox "Error in expression"
  770.           Exit Sub
  771.       End If
  772.     Command1.Enabled = False
  773.     Command2.Enabled = False
  774.     GrdSheet = expr.Value(txt)
  775.     Exit Sub
  776. prnError:
  777.     GrdSheet = ""
  778.   MsgBox "Error in expression"
  779.   Err.Clear
  780. End Sub
  781. Private Sub Command2_Click()
  782. txtFormula.Text = ""
  783. formula(GrdSheet.row, GrdSheet.col) = ""
  784. 'GrdSheet = ""
  785. End Sub
  786. Private Sub Form_Load()
  787. Dim Fot As Integer
  788.     ReDim formula(GrdSheet.Rows - 1, GrdSheet.Cols - 1)
  789.     ReDim GridArray(GrdSheet.Rows - 1, GrdSheet.Cols - 1)
  790.     Me.Left = GetSetting(App.Title, "Settings", "MainLeft", 1000)
  791.     Me.Top = GetSetting(App.Title, "Settings", "MainTop", 1000)
  792.    Me.Width = GetSetting(App.Title, "Settings", "MainWidth", 6500)
  793.     Me.Height = GetSetting(App.Title, "Settings", "MainHeight", 6500)
  794.     LabelGrdSheet
  795.     GrdSheet.row = 2: GrdSheet.col = 1: GrdSheet.row = 1
  796.     txtDim.Enabled = True
  797.     txtDim.Text = "Rows=" & Str(GrdSheet.Rows) & " : Cols=" & Str(GrdSheet.Cols)
  798.     txtDim.Enabled = False
  799.     Fot = Screen.FontCount - 1
  800.     For i = 1 To Fot  ' - 1
  801.     cmbFonts.AddItem Screen.Fonts(i)
  802.     Next
  803.     For i = 6 To 30 Step 2
  804.     cmbFontSize.AddItem i
  805.     Next
  806.     cmbFunc.AddItem "("
  807.   cmbFunc.AddItem "-"
  808.   cmbFunc.AddItem "NOT"
  809.   cmbFunc.AddItem ","
  810.   cmbFunc.AddItem ")"
  811.   cmbFunc.AddItem "^"
  812.   cmbFunc.AddItem "*"
  813.   cmbFunc.AddItem "/"
  814.   cmbFunc.AddItem "\"
  815.   cmbFunc.AddItem "MOD"
  816.   cmbFunc.AddItem "+"
  817.   cmbFunc.AddItem "-"
  818.   cmbFunc.AddItem "="
  819.   cmbFunc.AddItem "<"
  820.   cmbFunc.AddItem "<="
  821.   cmbFunc.AddItem ">"
  822.   cmbFunc.AddItem ">="
  823.   cmbFunc.AddItem "<>"
  824.   cmbFunc.AddItem "AND"
  825.   cmbFunc.AddItem "OR"
  826.   cmbFunc.AddItem "XOR"
  827.   cmbFunc.AddItem "PI"
  828.   cmbFunc.AddItem "DEG"
  829.   cmbFunc.AddItem "RAD"
  830.   cmbFunc.AddItem "ABS"
  831.   cmbFunc.AddItem "INT"
  832.   cmbFunc.AddItem "FIX"
  833.   cmbFunc.AddItem "SGN"
  834.   cmbFunc.AddItem "SQR"
  835.   cmbFunc.AddItem "LOG"
  836.   cmbFunc.AddItem "LN"
  837.   cmbFunc.AddItem "EXP"
  838.   cmbFunc.AddItem "SIN"
  839.   cmbFunc.AddItem "ASIN"
  840.   cmbFunc.AddItem "COS"
  841.   cmbFunc.AddItem "ACOS"
  842.   cmbFunc.AddItem "TAN"
  843.   cmbFunc.AddItem "ATN"
  844.   cmbFunc.AddItem "ATAN"
  845.   cmbFunc.AddItem "SEC"
  846.   cmbFunc.AddItem "CSC"
  847.   cmbFunc.AddItem "COT"
  848.   cmbFunc.AddItem "SIN_D"
  849.   cmbFunc.AddItem "COS_D"
  850.   cmbFunc.AddItem "TAN_D"
  851.   cmbFunc.AddItem "POWER"
  852.   cmbFunc.AddItem "MIN"
  853.   cmbFunc.AddItem "MAX"
  854.   cmbFunc.AddItem "LEN"
  855.   cmbFunc.AddItem "ASC"
  856.   cmbFunc.AddItem "SPACE"
  857.   cmbFunc.AddItem "STRING"
  858.   cmbFunc.AddItem "LEFT"
  859.   cmbFunc.AddItem "RIGHT"
  860.   cmbFunc.AddItem "MID"
  861.   cmbFunc.AddItem "INSTR"
  862.   cmbFunc.AddItem "&"
  863.   cmbFunc.AddItem "GAMMA"
  864.   cmbFunc.AddItem "SINH"
  865.  cmbFunc.AddItem "COSH"
  866.  cmbFunc.AddItem "TANH"
  867.  cmbFunc.AddItem "SUMABOVE"
  868.  cmbFunc.AddItem "ASINH"
  869.  cmbFunc.AddItem "ACOSH"
  870.  cmbFunc.Text = "="
  871.         AutoForm = True
  872. End Sub
  873. Private Sub Form_MouseDown(Button As Integer, Shift As Integer, x As Single, Y As Single)
  874. If Button = vbRightButton Then
  875. PopupMenu mnuEdit
  876. End If
  877. End Sub
  878. Private Sub Form_Resize()
  879. Frame.Move 0, tbToolBar.Height
  880. Frame.Width = ScaleWidth
  881. GrdSheet.Move (Width - GrdSheet.Width) / 2, tbToolBar.Height + Frame.Height + frFonts.Height
  882. End Sub
  883. Private Sub Form_Unload(Cancel As Integer)
  884.     For i = Forms.Count - 1 To 1 Step -1
  885.         Unload Forms(i)
  886.     Next
  887.     If Me.WindowState <> vbMinimized Then
  888.         SaveSetting App.Title, "Settings", "MainLeft", Me.Left
  889.         SaveSetting App.Title, "Settings", "MainTop", Me.Top
  890.         SaveSetting App.Title, "Settings", "MainWidth", Me.Width
  891.         SaveSetting App.Title, "Settings", "MainHeight", Me.Height
  892.     End If
  893. End Sub
  894. Private Sub mnuAutoFormat_Click()
  895. AutoForm = Not AutoForm
  896. End Sub
  897. Private Sub mnuEditCopyFormula_Click()
  898. formulaCopy = formula(GrdSheet.row, GrdSheet.col)
  899. mnuEditPasteSpecial.Enabled = True
  900. End Sub
  901. Private Sub mnuFormatCell_Click()
  902. txt = InputBox("Please enter a format string eg. #0.0#" + vbCrLf + "any number of place holders # and 0 can be entered" + vbCrLf + "Other characters are also permissible")
  903. If txt = "" Then
  904. Exit Sub
  905. End If
  906. GrdSheet.Text = Format(Val(GrdSheet.Text), txt)
  907. End Sub
  908. Private Sub mnuFormatCol_Click()
  909. frmFormat.Frame2.Visible = True
  910. frmFormat.Caption = "Format Col width"
  911. frmFormat.Text2.Text = GrdSheet.COLWIDTH(GrdSheet.col)
  912. frmFormat.Show vbModal
  913. End Sub
  914. Private Sub mnuFormatRow_Click()
  915. frmFormat.Frame1.Visible = True
  916. frmFormat.Caption = "Format Row"
  917. frmFormat.Text1.Text = GrdSheet.RowHeight(GrdSheet.row)
  918. frmFormat.Show vbModal
  919. End Sub
  920. Private Sub mnuGrd_Click()
  921. mnuFileNew_Click
  922. GrdSheet.Clear
  923.     With dlgDlg
  924.         .DialogTitle = "Open"
  925.         .CancelError = False
  926.         .FileName = ""
  927.         'ToDo: set the flags and attributes of the common dialog control
  928.         .Filter = "Grd Files (*.grd)|*.grd"
  929.         .ShowOpen
  930.         If Len(.FileName) = 0 Then
  931.             Exit Sub
  932.         End If
  933.         sfile = .FileName
  934.     End With
  935.     OpenGrd sfile
  936.     LabelGrdSheet
  937.     GrdSheet.row = 1: GrdSheet.col = 1
  938.       
  939. End Sub
  940. Private Sub mnuResize_Click()
  941.  NewCols = GrdSheet.Width
  942.      NewRows = GrdSheet.Height
  943.     frmOption.lblCols.Caption = "Height"
  944.     frmOption.lblRows.Caption = "Width"
  945.     frmOption.txtCols.Text = GrdSheet.Height
  946.     frmOption.txtRows.Text = GrdSheet.Width
  947.     frmOption.Show vbModal
  948.     If Cancel = True Then
  949. Cancel = False
  950. Exit Sub
  951. End If
  952.       GrdSheet.Width = NewRows
  953.       If GrdSheet.Height >= ScaleWidth Then
  954.       GrdSheet.Height = ScaleWidth
  955.       Else
  956.       GrdSheet.Height = NewCols
  957.       End If
  958.       GrdSheet.Move (Width - GrdSheet.Width) / 2, tbToolBar.Height + Frame.Height + frFonts.Height
  959.    GrdSheet.row = 1: GrdSheet.col = 1
  960. End Sub
  961. Private Sub mnuRowCol_Click()
  962.      On Local Error Resume Next
  963.      NewCols = GrdSheet.Cols
  964.      NewRows = GrdSheet.Rows
  965.     frmOption.lblCols.Caption = "Cols"
  966.     frmOption.lblRows.Caption = "Rows"
  967.     frmOption.txtCols.Text = GrdSheet.Cols
  968.     frmOption.txtRows.Text = GrdSheet.Rows
  969.     frmOption.Show vbModal
  970.     If Cancel = True Then
  971. Cancel = False
  972. Exit Sub
  973. End If
  974. If NewRows > 101 Or NewCols > 101 Then
  975. End If
  976. ReDim tempdata(GrdSheet.Rows - 1, GrdSheet.Cols - 1)
  977. ReDim tempformula(GrdSheet.Rows - 1, GrdSheet.Cols - 1)
  978. For i = 1 To GrdSheet.Rows - 1
  979. For j = 1 To GrdSheet.Cols - 1
  980. tempdata(i, j) = GridArray(i, j)
  981. tempformula(i, j) = formula(i, j)
  982. Next: Next
  983.     With GrdSheet
  984.     .Rows = NewRows
  985.     .Cols = NewCols
  986.     End With
  987.     ReDim GridArray(NewRows - 1, NewCols - 1)
  988.     ReDim formula(GrdSheet.Rows - 1, GrdSheet.Cols - 1)
  989.     For i = 1 To GrdSheet.Rows - 1
  990.     For j = 1 To GrdSheet.Cols - 1
  991.  GridArray(i, j) = tempdata(i, j)
  992.  formula(i, j) = tempformula(i, j)
  993.     Next: Next
  994.     txtDim.Enabled = True
  995.     txtDim.Text = "Rows=" & Str(GrdSheet.Rows) & " : Cols=" & Str(GrdSheet.Cols)
  996.     txtDim.Enabled = False
  997.     LabelGrdSheet
  998.     GrdSheet.row = 1: GrdSheet.col = 1
  999. End Sub
  1000. Private Sub mnuSaveExL_Click()
  1001.     Dim irow As Long, icol As Long
  1002. With dlgDlg
  1003.         .DialogTitle = "Save as Excel"
  1004.         .FileName = ""
  1005.         .CancelError = False
  1006.         .Filter = "Text Files (*.xls)|*.xls"
  1007.         .ShowSave
  1008.         If Len(.FileName) = 0 Then
  1009.             Exit Sub
  1010.         End If
  1011.         sfile = .FileName
  1012.     End With
  1013.     If InStr(sfile, ".xls") = 0 Then
  1014.     sfile = sfil & ".xls"
  1015. End If
  1016. With myExcelFile
  1017.     FileName$ = sfile
  1018.     .CreateFile FileName$
  1019.     'set a Password for the file. If set, the rest of the spreadsheet will
  1020.     'be encrypted. If a password is used it must immediately follow the
  1021.     'CreateFile method.
  1022.     'This is different then protecting the spreadsheet (see below).
  1023.     'NOTE: For some reason this function does not work. Excel will
  1024.     'recognize that the file is password protected, but entering the password
  1025.     'will not work. Also, the file is not encrypted. Therefore, do not use
  1026.     'this function until I can figure out why it doesn't work. There is not
  1027.     'much documentation on this function available.
  1028.     '.SetFilePassword "PAUL"
  1029.     'specify whether to print the gridlines or not
  1030.     'this should come before the setting of fonts and margins
  1031.     .PrintGridLines = False
  1032.     'it is a good idea to set margins, fonts and column widths
  1033.     'prior to writing any text/numerics to the spreadsheet. These
  1034.     'should come before setting the fonts.
  1035. '    .SetMargin xlsTopMargin, 1.5   'set to 1.5 inches
  1036.  '   .SetMargin xlsLeftMargin, 1.5
  1037.   '  .SetMargin xlsRightMargin, 1.5
  1038.    ' .SetMargin xlsBottomMargin, 1.5
  1039.     'to insert a Horizontal Page Break you need to specify the row just
  1040.     'after where you want the page break to occur. You can insert as many
  1041.     'page breaks as you wish (in any order).
  1042.    ' .InsertHorizPageBreak 10
  1043.     '.InsertHorizPageBreak 20
  1044.     'Up to 4 fonts can be specified for the spreadsheet. This is a
  1045.     'limitation of the Excel 2.1 format. For each value written to the
  1046.     'spreadsheet you can specify which font to use.
  1047.     .SetFont "Arial", 10, xlsNoFormat              'font0
  1048.     .SetFont "Arial", 10, xlsBold                  'font1
  1049.     .SetFont "Arial", 10, xlsBold + xlsUnderline   'font2
  1050.     .SetFont "Courier", 12, xlsItalic              'font3
  1051.     'Column widths are specified in Excel as 1/256th of a character.
  1052.     '.SetColumnWidth 1, 5, 18
  1053.     'set any header or footer that you want to print on
  1054.     'every page. This text will be centered at the top and/or
  1055.     'bottom of each page. The font will always be the font that
  1056.     'is specified as font0, therefore you should only set the
  1057.     'header/footer after specifying the fonts through SetFont.
  1058.     '.SetHeader "This is the header"
  1059.     '.SetFooter "This is the footer"
  1060.     'write some data to the spreadsheet
  1061.     'Use the default format #3 "#,##0" (refer to the WriteDefaultFormats function)
  1062.     'The WriteDefaultFormats function is compliments of Dieter Hauk in Germany.
  1063.     '.WriteValue xlsInteger, xlsFont0, xlsLeftAlign, xlsNormal, 6, 1, 2000, 3
  1064.     'write a cell with a shaded number with a bottom border
  1065.     '.WriteValue xlsNumber, xlsFont1, xlsrightAlign + xlsBottomBorder + xlsShaded, xlsNormal, 7, 1, 12123.456, 4
  1066.     'write a normal left aligned string using font2 (bold & underline)
  1067.     For irow = 1 To GrdSheet.Rows - 1
  1068.     GrdSheet.row = irow
  1069.     For icol = 1 To GrdSheet.Cols - 1
  1070.     GrdSheet.col = icol
  1071.     .SetFont GrdSheet.CellFontName, 10, xlsNoFormat
  1072.     .WriteValue xlsText, xlsFont0, xlsLeftAlign, xlsNormal, irow, icol, GrdSheet.Text
  1073.     If formula(GrdSheet.row, GrdSheet.col) > "" Then
  1074.     .WriteValue xlsText, xlsFont0, xlsCentreAlign, xlsHidden, irow, icol, formula(GrdSheet.row, GrdSheet.col)
  1075.         End If
  1076.     'write a locked cell. The cell will not be able to be overwritten, BUT you
  1077.     'must set the sheet PROTECTION to on before it will take effect!!!
  1078.     '.WriteValue xlsText, xlsFont3, xlsLeftAlign, xlsLocked, 9, 1, "This cell is locked"
  1079.     'fill the cell with "F"'s
  1080.     '.WriteValue xlsText, xlsFont0, xlsFillCell, xlsNormal, 10, 1, "F"
  1081.     'write a hidden cell to the spreadsheet. This only works for cells
  1082.     'that contain formulae. Text, Number, Integer value text can not be hidden
  1083.     'using this feature. It is included here for the sake of completeness.
  1084.     '.WriteValue xlsText, xlsFont0, xlsCentreAlign, xlsHidden, 11, 1, "If this were a formula it would be hidden!"
  1085.     'Dim d As Date
  1086.     'd = "2001/01/15"
  1087.     '.WriteValue xlsText, xlsFont0, xlsCentreAlign, xlsNormal, 15, 1, d, 12
  1088.     'PROTECT the spreadsheet so any cells specified as LOCKED will not be
  1089.     'overwritten. Also, all cells with HIDDEN set will hide their formulae.
  1090.     'PROTECT does not use a password.
  1091.     '.ProtectSpreadsheet = True
  1092.     'Finally, close the spreadsheet
  1093.     .CloseFile
  1094.     Close
  1095. End With
  1096. Close
  1097.     MsgBox "Excel BIFF Spreadsheet created." & vbCrLf & "Filename: " & FileName$, vbInformation + vbOKOnly, "Excel Class"
  1098. End Sub
  1099. Private Sub mnuSaveGrd_Click()
  1100. With dlgDlg
  1101.         .DialogTitle = "Save"
  1102.         .FileName = ""
  1103.         
  1104.         .CancelError = False
  1105.         .Filter = "Grd Files (*.grd)|*.grd"
  1106.         .ShowSave
  1107.         If Len(.FileName) = 0 Then
  1108.             Exit Sub
  1109.         End If
  1110.         sfile = .FileName
  1111.     End With
  1112.     SaveGrd sfile
  1113. End Sub
  1114. Private Sub mnuSaveTxt_Click()
  1115. With dlgDlg
  1116.         .DialogTitle = "Save as Text"
  1117.         .FileName = ""
  1118.         .CancelError = False
  1119.         .Filter = "Text Files (*.dat)|*.dat"
  1120.         .ShowSave
  1121.         If Len(.FileName) = 0 Then
  1122.             Exit Sub
  1123.         End If
  1124.         sfile = .FileName
  1125.     End With
  1126.     SaveText sfile
  1127.     GrdSheet.row = 1: GrdSheet.col = 1
  1128. End Sub
  1129. Private Sub mnuText_Click()
  1130.     With dlgDlg
  1131.         .DialogTitle = "Open"
  1132.         .FileName = ""
  1133.         .CancelError = False
  1134.         .Filter = "Text Files (*.dat)|*.dat"
  1135.         .ShowOpen
  1136.         If Len(.FileName) = 0 Then
  1137.             Exit Sub
  1138.         End If
  1139.         sfile = .FileName
  1140.     End With
  1141.     OpenText sfile
  1142.     GrdSheet.row = 1: GrdSheet.col = 1
  1143.    LabelGrdSheet
  1144. End Sub
  1145. Private Sub GrdSheet_DblClick()
  1146. If txtFormula.Text = "" Then
  1147. txtFormula.Text = "="
  1148. txtFormula.SelStart = 1
  1149. End If
  1150. txtFormula.SetFocus
  1151. End Sub
  1152. Private Sub GrdSheet_EnterCell()
  1153. If GrdSheet.col = 0 Or GrdSheet.row = 0 Then
  1154. Exit Sub
  1155. End If
  1156.  cmbFontSize.Text = GrdSheet.CellFontSize
  1157.   cmbFonts.Text = GrdSheet.CellFontName
  1158. If GrdSheet.CellFontUnderline = True Then
  1159. tbToolBar.Buttons.Item(13).Value = tbrPressed
  1160. tbToolBar.Buttons.Item(13).Value = tbrUnpressed
  1161. End If
  1162. If GrdSheet.CellFontBold = True Then
  1163. tbToolBar.Buttons.Item(11).Value = tbrPressed
  1164. tbToolBar.Buttons.Item(11).Value = tbrUnpressed
  1165. End If
  1166. If GrdSheet.CellFontItalic = True Then
  1167. tbToolBar.Buttons.Item(12).Value = tbrPressed
  1168. tbToolBar.Buttons.Item(12).Value = tbrUnpressed
  1169. End If
  1170. GrdSheet.CellBackColor = QBColor(15)
  1171. txtRowCol = Str(GrdSheet.row) + " : " + Str(GrdSheet.col)
  1172. GridArray(GrdSheet.row, GrdSheet.col) = GrdSheet.Text
  1173. txtCellVal.Text = GrdSheet
  1174. txtFormula = formula(GrdSheet.row, GrdSheet.col)
  1175. If txtFormula = "" Then
  1176. Command1.Enabled = False
  1177. Command2.Enabled = False
  1178. End If
  1179.     Select Case GrdSheet.CellAlignment
  1180.     Case 2
  1181.         tbToolBar.Buttons.Item(15).Value = tbrUnpressed
  1182.         tbToolBar.Buttons.Item(16).Value = tbrUnpressed
  1183.         tbToolBar.Buttons.Item(17).Value = tbrUnpressed
  1184.         tbToolBar.Buttons.Item(15).Value = tbrPressed
  1185.        
  1186.        Case 3
  1187.        tbToolBar.Buttons.Item(15).Value = tbrUnpressed
  1188.         tbToolBar.Buttons.Item(16).Value = tbrUnpressed
  1189.         tbToolBar.Buttons.Item(17).Value = tbrUnpressed
  1190.        
  1191.         tbToolBar.Buttons.Item(16).Value = tbrPressed
  1192.        
  1193.             Case 6
  1194.             tbToolBar.Buttons.Item(17).Value = tbrPressed
  1195.             tbToolBar.Buttons.Item(15).Value = tbrUnpressed
  1196.         tbToolBar.Buttons.Item(16).Value = tbrUnpressed
  1197.        
  1198.        Case Else
  1199.        tbToolBar.Buttons.Item(15).Value = tbrUnpressed
  1200.         tbToolBar.Buttons.Item(16).Value = tbrUnpressed
  1201.         tbToolBar.Buttons.Item(17).Value = tbrUnpressed
  1202.            
  1203.    End Select
  1204. End Sub
  1205. Private Sub GrdSheet_KeyPress(KeyAscii As Integer)
  1206. Select Case KeyAscii
  1207. Case 13, 27
  1208. KeyAscii = 0
  1209. Case 8
  1210. GrdSheet.Text = Left(GrdSheet.Text, Len(GrdSheet.Text) - 1)
  1211. Case Else
  1212. GrdSheet.Text = GrdSheet.Text + Chr(KeyAscii)
  1213. End Select
  1214. txtCellVal.Text = GrdSheet.Text
  1215. End Sub
  1216. Private Sub GrdSheet_LeaveCell()
  1217. If GrdSheet.col = 0 Or GrdSheet.row = 0 Then
  1218. Exit Sub
  1219. End If
  1220. GrdSheet.CellBackColor = &HC0FFFF
  1221. GridArray(GrdSheet.row, GrdSheet.col) = GrdSheet.Text
  1222. formula(GrdSheet.row, GrdSheet.col) = txtFormula.Text
  1223. If GrdSheet.COLWIDTH(GrdSheet.col) < 12.5 * Len(GrdSheet.Text) * GrdSheet.CellFontSize Then
  1224. GrdSheet.COLWIDTH(GrdSheet.col) = 12.5 * Len(GrdSheet.Text) * GrdSheet.CellFontSize
  1225. End If
  1226. If GrdSheet.RowHeight(GrdSheet.row) < 29 * GrdSheet.CellFontSize Then
  1227. GrdSheet.RowHeight(GrdSheet.row) = 29 * GrdSheet.CellFontSize
  1228. End If
  1229. End Sub
  1230. Private Sub GrdSheet_MouseDown(Button As Integer, Shift As Integer, x As Single, Y As Single)
  1231. If Button = vbRightButton Then
  1232. PopupMenu mnuEdit
  1233. End If
  1234. End Sub
  1235. Private Sub tbToolBar_ButtonClick(ByVal Button As MSComctlLib.Button)
  1236.     Select Case Button.Key
  1237.         Case "New"
  1238.             'ToDo: Add 'New' button code.
  1239.             mnuFileNew_Click
  1240.         Case "Open"
  1241.          'mnuFileOpen_Click
  1242.         Case "Save"
  1243.         Case "Print"
  1244.             mnuFilePrint_Click
  1245.         Case "Cut"
  1246.             mnuEditCut_Click
  1247.         Case "Copy"
  1248.             mnuEditCopy_Click
  1249.         Case "Paste"
  1250.             mnuEditPaste_Click
  1251.         Case "Bold"
  1252.             Bold
  1253.         
  1254.         Case "Italic"
  1255.         italic
  1256.         Case "Underline"
  1257.             UnderLine
  1258.         
  1259.         Case "Align Left"
  1260.         GrdSheet.CellAlignment = 2
  1261.         
  1262.         Case "Center"
  1263.         GrdSheet.CellAlignment = 3
  1264.         
  1265.         Case "Align Right"
  1266.             
  1267.             GrdSheet.CellAlignment = 6
  1268.     End Select
  1269. End Sub
  1270. Private Sub mnuHelpAbout_Click()
  1271.     MsgBox "Version " & App.Major & "." & App.Minor & "." & App.Revision
  1272. End Sub
  1273. Private Sub mnuHelpSearchForHelpOn_Click()
  1274.     Dim nRet As Integer
  1275.     frmBrowser.Show vbModal
  1276. End Sub
  1277. Private Sub mnuHelpContents_Click()
  1278.     Dim nRet As Integer
  1279.     'if there is no helpfile for this project display a message to the user
  1280.     'you can set the HelpFile for your application in the
  1281.     'Project Properties dialog
  1282.     If Len(App.HelpFile) = 0 Then
  1283.         MsgBox "Unable to display Help Contents. There is no Help associated with this project.", vbInformation, Me.Caption
  1284.     Else
  1285.         On Error Resume Next
  1286.         nRet = OSWinHelp(Me.hwnd, App.HelpFile, 3, 0)
  1287.         If Err Then
  1288.             MsgBox Err.Description
  1289.         End If
  1290.     End If
  1291. End Sub
  1292. Private Sub mnuViewOptions_Click()
  1293.            mnuAutoFormat.Checked = AutoForm
  1294. End Sub
  1295. Private Sub mnuViewStatusBar_Click()
  1296.     mnuViewStatusBar.Checked = Not mnuViewStatusBar.Checked
  1297.     sbStatusBar.Visible = mnuViewStatusBar.Checked
  1298. End Sub
  1299. Private Sub mnuViewToolbar_Click()
  1300.     mnuViewToolbar.Checked = Not mnuViewToolbar.Checked
  1301.     tbToolBar.Visible = mnuViewToolbar.Checked
  1302. End Sub
  1303. Private Sub mnuEditPasteSpecial_Click()
  1304.  formula(GrdSheet.row, GrdSheet.col) = formulaCopy
  1305.  frmMain.txtFormula.Text = formulaCopy
  1306.  Command1_Click
  1307.  mnuEditPasteSpecial.Enabled = False
  1308. End Sub
  1309. Private Sub mnuEditPaste_Click()
  1310. CurrCol = GrdSheet.col
  1311. currRow = GrdSheet.row
  1312.  CutText = Trim(Clipboard.GetText)
  1313.  GrdSheet.Clip = Clipboard.GetText
  1314.  GrdSheet.col = 1: GrdSheet.row = 1
  1315.  For i = currRow To currRow '+ R
  1316.  GrdSheet.row = i
  1317.  For j = CurrCol To CurrCol '+ C
  1318.  GrdSheet.col = j
  1319.  Next
  1320.  Next
  1321.  GrdSheet.row = currRow: GrdSheet.col = CurrCol
  1322.    RefreshData
  1323.    GrdSheet.row = 1: GrdSheet.col = 1
  1324. End Sub
  1325. Private Sub mnuEditCopy_Click()
  1326.     Clipboard.Clear
  1327.     Clipboard.SetText GrdSheet.Clip
  1328. End Sub
  1329. Private Sub mnuEditCut_Click()
  1330.     Clipboard.SetText GrdSheet.Clip
  1331.     Cut
  1332. End Sub
  1333. Private Sub mnuEditUndo_Click()
  1334.     MsgBox "Add 'mnuEditUndo_Click' code."
  1335. End Sub
  1336. Private Sub mnuFileExit_Click()
  1337.     Unload Me
  1338. End Sub
  1339. Private Sub mnuFileSend_Click()
  1340.     MsgBox "Add 'mnuFileSend_Click' code."
  1341. End Sub
  1342. Private Sub mnuFilePrint_Click()
  1343.     dlgDlg.DialogTitle = "Print"
  1344.     dlgDlg.ShowPrinter
  1345.     For i = 1 To GrdSheet.Rows - 1
  1346.     For j = 1 To GrdSheet.Cols - 1
  1347.     txt = txt + GridArray(i, j) + vbTab
  1348.     Next
  1349.     txt = txt + vbCrLf
  1350.     Next
  1351.     Clipboard.SetText txt
  1352.     Printer.Print txt
  1353.     Printer.EndDoc
  1354. End Sub
  1355. Private Sub mnuFilePrintPreview_Click()
  1356.     MsgBox "Add 'mnuFilePrintPreview_Click' code."
  1357. End Sub
  1358. Private Sub mnuFilePageSetup_Click()
  1359.     On Error Resume Next
  1360.     With dlgDlg
  1361.         .DialogTitle = "Page Setup"
  1362.         .CancelError = True
  1363.         .ShowPrinter
  1364.     End With
  1365. End Sub
  1366. Private Sub mnuFileProperties_Click()
  1367.     MsgBox "Add 'mnuFileProperties_Click' code."
  1368. End Sub
  1369. Private Sub mnuFileSaveAll_Click()
  1370.     MsgBox "Add 'mnuFileSaveAll_Click' code."
  1371. End Sub
  1372. Private Sub mnuFileSaveAs_Click()
  1373.     MsgBox "Add 'mnuFileSaveAs_Click' code."
  1374. End Sub
  1375. Private Sub mnuFileClose_Click()
  1376.     MsgBox "Add 'mnuFileClose_Click' code."
  1377. End Sub
  1378. Private Sub mnuFileNew_Click()
  1379. ReDim GridArray(10, 10)
  1380.     ReDim formula(10, 10)
  1381.     With GrdSheet
  1382.     ReDim formula(10, 10)
  1383.     .Clear
  1384.     .Rows = 10
  1385.     .Cols = 10
  1386.     For i = 1 To .Rows - 1
  1387.     .row = i
  1388.     For j = 1 To .Cols - 1
  1389.     .col = j
  1390.     GrdSheet = "": formula(i, j) = ""
  1391.     Next
  1392.     Next
  1393.     End With
  1394.     ReDim GridArray(10, 10)
  1395.     ReDim formula(10, 10)
  1396. GrdSheet.Clear
  1397. formula(1, 1) = ""
  1398. ReDim formula(10, 10)
  1399. LabelGrdSheet
  1400. GrdSheet.row = 1
  1401. GrdSheet.col = 1
  1402. End Sub
  1403. Sub LabelGrdSheet()
  1404. GrdSheet.CellAlignment = flexAlignCenterCenter '4
  1405. With GrdSheet
  1406. .row = 0
  1407. For i = .FixedCols To .Cols - 1
  1408.     .col = i
  1409.     .COLWIDTH(.col) = 912
  1410.     GrdSheet.CellFontBold = True
  1411.     .Text = Str(i)
  1412.     Next
  1413.     .col = 0
  1414. For i = .FixedRows To .Rows - 1
  1415.     .row = i
  1416.     .RowHeight(.row) = 228
  1417.     GrdSheet.CellFontBold = True
  1418.     .Text = Str(i)
  1419.     Next
  1420.  .row = 1
  1421.  .col = 1
  1422.     End With
  1423. End Sub
  1424. Sub Bold()
  1425. Rs = GrdSheet.RowSel
  1426. Cs = GrdSheet.ColSel
  1427. rr = GrdSheet.row
  1428. cc = GrdSheet.col
  1429. If tbToolBar.Buttons.Item(11).Value = tbrPressed Then
  1430.  PressB = True
  1431.  PressB = False
  1432. End If
  1433. For ro = rr To GrdSheet.RowSel    'If Selected for the Top Left
  1434. For co = cc To GrdSheet.ColSel
  1435.  GrdSheet.row = ro
  1436.  GrdSheet.col = co
  1437.  GrdSheet.CellFontBold = PressB
  1438. Next co
  1439. Next ro
  1440. For ro = GrdSheet.row To GrdSheet.RowSel Step -1 'If Selected for the Top Right
  1441. For co = GrdSheet.col To GrdSheet.ColSel Step -1
  1442.  GrdSheet.row = ro
  1443.  GrdSheet.col = co
  1444.  GrdSheet.CellFontBold = PressB
  1445. Next co
  1446. Next ro
  1447. For ro = GrdSheet.RowSel To GrdSheet.row Step -1 'If Selected for the Bottom Left
  1448. For co = GrdSheet.col To GrdSheet.ColSel Step -1
  1449.  GrdSheet.row = ro
  1450.  GrdSheet.col = co
  1451.  GrdSheet.CellFontBold = PressB
  1452. Next co
  1453. Next ro
  1454. For ro = GrdSheet.row To GrdSheet.RowSel Step -1 'If Selected for the Bottom Right
  1455. For co = GrdSheet.ColSel To GrdSheet.col Step -1
  1456.  GrdSheet.row = ro
  1457.  GrdSheet.col = co
  1458.  GrdSheet.CellFontBold = PressB
  1459. Next co
  1460. Next ro
  1461. GrdSheet.row = rr
  1462. GrdSheet.col = cc
  1463.  GrdSheet.RowSel = Rs
  1464.  GrdSheet.ColSel = Cs
  1465. Exit Sub
  1466. last:
  1467. End Sub
  1468. Sub italic()
  1469. 'Dim rr, cc, Rs, Cs, ro, co
  1470. rr = GrdSheet.row
  1471. cc = GrdSheet.col
  1472.  Rs = GrdSheet.RowSel
  1473.  Cs = GrdSheet.ColSel
  1474. If tbToolBar.Buttons.Item(12).Value = tbrPressed Then
  1475.  PressI = True
  1476.  PressI = False
  1477. End If
  1478. For ro = rr To GrdSheet.RowSel 'If Selected for the Top Left
  1479. For co = cc To GrdSheet.ColSel
  1480.  GrdSheet.row = ro
  1481.  GrdSheet.col = co
  1482.  GrdSheet.CellFontItalic = PressI
  1483. Next co
  1484. Next ro
  1485. For ro = rr To GrdSheet.RowSel Step -1 'If Selected for the Top Right
  1486. For co = cc To GrdSheet.ColSel Step -1
  1487.  GrdSheet.row = ro
  1488.  GrdSheet.col = co
  1489.  GrdSheet.CellFontItalic = PressI
  1490. Next co
  1491. Next ro
  1492. For ro = rr To GrdSheet.row Step -1 'If Selected for the Bottom Left
  1493. For co = cc To GrdSheet.ColSel Step -1
  1494.  GrdSheet.row = ro
  1495.  GrdSheet.col = co
  1496.  GrdSheet.CellFontItalic = PressI
  1497. Next co
  1498. Next ro
  1499. For ro = rr To GrdSheet.RowSel Step -1 'If Selected for the Bottom Right
  1500. For co = cc To GrdSheet.col Step -1
  1501.  GrdSheet.row = ro
  1502.  GrdSheet.col = co
  1503.  GrdSheet.CellFontItalic = PressI
  1504. Next co
  1505. Next ro
  1506. GrdSheet.row = rr
  1507. GrdSheet.col = cc
  1508.  GrdSheet.RowSel = Rs
  1509.  GrdSheet.ColSel = Cs
  1510. End Sub
  1511. Sub UnderLine()
  1512. rr = GrdSheet.row
  1513. cc = GrdSheet.col
  1514. Rs = GrdSheet.RowSel
  1515.  Cs = GrdSheet.ColSel
  1516. If tbToolBar.Buttons.Item(13).Value = tbrPressed Then
  1517.  PressU = True
  1518.  PressU = False
  1519. End If
  1520. For ro = rr To GrdSheet.RowSel 'If Selected for the Top Left
  1521. For co = cc To GrdSheet.ColSel
  1522.  GrdSheet.row = ro
  1523.  GrdSheet.col = co
  1524.  GrdSheet.CellFontUnderline = PressU
  1525. Next co
  1526. Next ro
  1527. For ro = rr To GrdSheet.RowSel Step -1 'If Selected for the Top Right
  1528. For co = cc To GrdSheet.ColSel Step -1
  1529.  GrdSheet.row = ro
  1530.  GrdSheet.col = co
  1531.  GrdSheet.CellFontUnderline = PressU
  1532. Next co
  1533. Next ro
  1534. For ro = rr To GrdSheet.row Step -1 'If Selected for the Bottom Left
  1535. For co = cc To GrdSheet.ColSel Step -1
  1536.  GrdSheet.row = ro
  1537.  GrdSheet.col = co
  1538.  GrdSheet.CellFontUnderline = PressU
  1539. Next co
  1540. Next ro
  1541. For ro = rr To GrdSheet.RowSel Step -1 'If Selected for the Bottom Right
  1542. For co = cc To GrdSheet.col Step -1
  1543.  GrdSheet.row = ro
  1544.  GrdSheet.col = co
  1545.  GrdSheet.CellFontUnderline = PressU
  1546. Next co
  1547. Next ro
  1548. GrdSheet.row = rr
  1549. GrdSheet.col = cc
  1550.  GrdSheet.RowSel = Rs
  1551.  GrdSheet.ColSel = Cs
  1552. End Sub
  1553. Sub OpenText(f)
  1554. Close
  1555. On Local Error GoTo ErrorText
  1556. GrdSheet.Rows = 1: GrdSheet.Cols = 1
  1557. GrdSheet.Clear
  1558. n = FreeFile
  1559. Open f For Input As #n
  1560. With GrdSheet
  1561. Input #n, i
  1562. .Rows = i
  1563. Input #n, j
  1564. .Cols = j
  1565. ReDim GridArray(i - 1, j - 1)
  1566. ReDim formula(i - 1, j - 1)
  1567. For i = 1 To .Rows - 1
  1568.   .row = i
  1569. For j = 1 To .Cols - 1
  1570. .col = j
  1571. Line Input #n, Text
  1572. .Text = Text
  1573. For i = 1 To .Rows - 1
  1574. For j = 1 To .Cols - 1
  1575. End With
  1576. Close
  1577. Exit Sub
  1578. ErrorText: Close
  1579. MsgBox "Error in file"
  1580. mnuFileNew_Click
  1581. End Sub
  1582. Sub SaveText(f)
  1583. Close
  1584. n = FreeFile
  1585. Open f For Output As #n
  1586. Print #n, GrdSheet.Rows, GrdSheet.Cols
  1587. For i = 1 To GrdSheet.Rows - 1
  1588. For j = 1 To GrdSheet.Cols - 1
  1589. Print #n, GridArray(i, j)
  1590. Close n
  1591. End Sub
  1592. Private Sub txtFormula_Change()
  1593. If Left(txtFormula.Text, 1) = "=" Then
  1594. Command1.Enabled = True
  1595. Command2.Enabled = True
  1596. End If
  1597. End Sub
  1598. Sub RefreshData()
  1599. With GrdSheet
  1600. ReDim GridArray(.Rows - 1, .Cols - 1)
  1601. For i = 1 To .Rows - 1
  1602. .row = i
  1603. For j = 1 To .Cols - 1
  1604. .col = j
  1605. GridArray(i, j) = .Text
  1606. End With
  1607. Rowss = GrdSheet.Rows
  1608. Colss = GrdSheet.Cols
  1609. ReDim temp(Rowss - 1, Colss - 1)
  1610. For i = 1 To GrdSheet.Rows - 1
  1611. For j = 1 To GrdSheet.Cols - 1
  1612. temp(i, j) = formula(i, j)
  1613. For i = 1 To GrdSheet.Rows - 1
  1614. For j = 1 To GrdSheet.Cols - 1
  1615. formula(i, j) = temp(i, j)
  1616. End Sub
  1617. Sub SaveGrd(f)
  1618. n = FreeFile
  1619. Open f For Output As #n
  1620. With GrdSheet
  1621. Print #n, .Rows, .Cols
  1622. For i = 1 To .Rows - 1
  1623. .row = i
  1624. For j = 1 To .Cols - 1
  1625. .col = j
  1626. Write #n, .Text
  1627. Print #n, formula(i, j)
  1628. Write #n, .CellAlignment
  1629. Write #n, .CellFontBold
  1630. Write #n, .CellFontItalic
  1631. Write #n, .CellFontUnderline
  1632. Print #n, formula(i, j)
  1633. End With
  1634. For i = 1 To GrdSheet.Rows - 1
  1635. For j = 1 To GrdSheet.Cols - 1
  1636. Write #n, GridArray(i, j)
  1637. Print #n, formula(i, j)
  1638. Close n
  1639. End Sub
  1640. Sub OpenGrd(f)
  1641. On Error GoTo ErrorGrd
  1642. GrdSheet.Rows = 1: GrdSheet.Cols = 1
  1643. GrdSheet.Clear
  1644. n = FreeFile
  1645. Open f For Input As #n
  1646. With GrdSheet
  1647. Input #n, Rowss, Colss
  1648. .Rows = Rowss: .Cols = Colss
  1649. ReDim GridArray(Rowss - 1, Colss - 1), formula(Rowss - 1, Colss - 1)
  1650. For i = 1 To .Rows - 1
  1651. .row = i
  1652. For j = 1 To .Cols - 1
  1653. .col = j
  1654. Input #n, Text
  1655. .Text = Text
  1656. GridArray(i, j) = .Text
  1657. Line Input #n, formula(i, j)
  1658. Input #n, CellAlign
  1659. .CellAlignment = CellAlign
  1660. Input #n, CellFontBold
  1661. .CellFontBold = CellFontBold
  1662. Input #n, CellFontItalic
  1663. .CellFontItalic = CellFontItalic
  1664. Input #n, CellFontUnderline
  1665. .CellFontUnderline = CellFontUnderline
  1666. Line Input #n, formula(i, j)
  1667. End With
  1668. For i = 1 To GrdSheet.Rows - 1
  1669. For j = 1 To GrdSheet.Cols - 1
  1670. Input #n, GridArray(i, j)
  1671. Line Input #n, formula(i, j)
  1672. Close n
  1673. Exit Sub
  1674. ErrorGrd:
  1675. Close n
  1676. MsgBox "Error in file"
  1677. mnuFileNew_Click
  1678. End Sub
  1679. Sub Cut()
  1680. BR1 = GrdSheet.row
  1681. BC1 = GrdSheet.col
  1682. SelRow1 = GrdSheet.RowSel
  1683. SelCol1 = GrdSheet.ColSel
  1684. For ro = BR1 To SelRow1
  1685. For co = BC1 To SelCol1
  1686.  GrdSheet.TextMatrix(ro, co) = ""
  1687. Next co
  1688. Next ro
  1689. For ro = BR1 To SelRow1 Step -1
  1690. For co = BC1 To SelCol1 Step -1
  1691.  GrdSheet.TextMatrix(ro, co) = ""
  1692. Next co
  1693. Next ro
  1694. For ro = SelRow1 To BR1 Step -1
  1695. For co = BC1 To SelCol1 Step -1
  1696.  GrdSheet.TextMatrix(ro, co) = ""
  1697. Next co
  1698. Next ro
  1699. For ro = BR1 To SelRow1 Step -1
  1700. For co = SelCol1 To BC1 Step -1
  1701.   GrdSheet.TextMatrix(ro, co) = ""
  1702. Next co
  1703. Next ro
  1704. End Sub
  1705.