|
-
May 4th, 2004, 05:48 AM
#1
Excel on a form
I like flexgrids and have used them quite a bit but now I need something "more flexible" or powerful. Is it possible to place an actual Excel spreadsheet on a form?
Lottery is a tax on people who are bad at maths
If only mosquitoes sucked fat instead of blood...
To do is to be (Descartes). To be is to do (Sartre). To be do be do (Sinatra)
-
May 4th, 2004, 08:02 AM
#2
You may use OLE control.
EDIT: or launch entire Excel and make it a child of your form. Let me know if you want to go this way so I can post some sample.
Last edited by RhinoBull; May 4th, 2004 at 08:14 AM.
-
May 4th, 2004, 09:07 AM
#3
My idea is to have this spreadsheet on a separate form so I would then store in it the results from calculations performed on the main form. At the same time I could do statistics and make plots with those data using all the power built-in in Excel.
Lottery is a tax on people who are bad at maths
If only mosquitoes sucked fat instead of blood...
To do is to be (Descartes). To be is to do (Sartre). To be do be do (Sinatra)
-
May 4th, 2004, 09:15 AM
#4
For that purpose you don't even need to keep it open as you may simply set new values to cell(s) in the background.
VB Code:
Private Sub Command1_Click()
'=======================
Dim exl As Excel.Application
Dim wbk As Workbook
Dim wst As Worksheet
Dim filename As String
Dim varValue
Set exl = New Excel.Application
exl.DisplayAlerts = False
filename = App.Path & "\test.xls"
exl.Workbooks.Open filename
Set wbk = exl.ActiveWorkbook
Set wst = wbk.ActiveSheet
varValue = "abc"
wst.Range("A2").Value = varValue
exl.Quit
Set wst = Nothing
Set wbk = Nothing
Set exl = Nothing
End Sub
-
May 4th, 2004, 09:49 AM
#5
That's a nice example, though I assume you must end the job with SaveWorkspace rather than QUit or else you'll lose the data.
Thanks.
Lottery is a tax on people who are bad at maths
If only mosquitoes sucked fat instead of blood...
To do is to be (Descartes). To be is to do (Sartre). To be do be do (Sinatra)
-
May 4th, 2004, 10:11 AM
#6
Oops, of course ...
wst.Range("A2").Value = varValue
wbk.Save
...
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|