home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Visual Basic Programmer'…arterly (Limited Edition)
/
Visual_Basic_Programmers_Journal_VB-CD_Quarterly_Limited_Edition_1995.iso
/
code
/
ch15code
/
access.frm
next >
Wrap
Text File
|
1995-08-12
|
3KB
|
124 lines
VERSION 4.00
Begin VB.Form Form1
Caption = "Form1"
ClientHeight = 4236
ClientLeft = 2340
ClientTop = 2016
ClientWidth = 6720
Height = 4560
Left = 2292
LinkTopic = "Form1"
ScaleHeight = 4236
ScaleWidth = 6720
Top = 1740
Width = 6816
Begin VB.CommandButton cmdWord
Caption = "Run WordBasic Procedure"
Height = 495
Left = 3000
TabIndex = 4
Top = 2640
Width = 3135
End
Begin VB.CommandButton cmdVB4
Caption = "Run VB4 Procedure"
Height = 615
Left = 360
TabIndex = 2
Top = 3360
Width = 2295
End
Begin VB.CommandButton cmdVBA
Caption = "Run VBA Procedure"
Height = 615
Left = 360
TabIndex = 1
Top = 2640
Width = 2295
End
Begin VB.OLE oleWord
Class = "Word.Document.6"
Height = 2295
Left = 3000
OleObjectBlob = "ACCESS.frx":0000
TabIndex = 3
Top = 240
Width = 3135
End
Begin VB.OLE oleObject
Class = "Excel.Sheet.5"
Height = 2295
Left = 360
OleObjectBlob = "ACCESS.frx":2018
TabIndex = 0
Top = 240
Width = 2295
End
End
Attribute VB_Name = "Form1"
Attribute VB_Creatable = False
Attribute VB_Exposed = False
Private Sub cmdVBA_Click()
' Activate the object.
OLEOBJECT.DoVerb
' Run the macro.
OLEOBJECT.object.Application.Run "Book1!FillSheet"
' Close the object.
OLEOBJECT.Close
End Sub
Private Sub cmdVB4_Click()
FillSheet
End Sub
Sub FillSheet()
With OLEOBJECT.object
For i = 1 To 20
.Cells(i, 1).VALUE = i ^ 2
Next i
End With
End Sub
Sub VB4AccessTime()
Dim Sheet1 As Object, x As Object
Set Sheet1 = OLEOBJECT.object
time1 = Timer
For i = 1 To 1000
temp = Sheet1.UsedRange
Next i
MsgBox "Property access time: " & CSng(Timer - time1) / 1000
time1 = Timer
For i = 1 To 1000
Sheet1.Unprotect
Next i
MsgBox "Method access time: " & CSng(Timer - time1) / 1000
End Sub
Function FindPrime(n As Integer) As Integer
Dim i As Integer
n = Int(n)
If n <= 1 Then FindPrime = 1
For i = 2 To n
If (n Mod i) = 0 Then
FindPrime = FindPrime(n - i)
Exit Function
End If
Next i
FindPrime = n
End Function
Private Sub cmdWord_Click()
oleWord.DoVerb
With oleWord.object.Application.WordBasic
.toolsmacro Name:="CreateLetter", Run:=1
End With
oleWord.Close
End Sub