Using a excel sheet in a form
Hi.
I want to use an excel sheet in a form and read the edited values in the sheet.
First I inserted an "insertable object" Microsoft Excel Woksheet. However i can't access the values that the custumer puts in my sheet. I want to use something like:
Var1=Sheet.Cells(1,1)
It's that possible?
Anyone have any trick?
Thanks in advance!
Re: Using a excel sheet in a form
I'm guessing it might be easier to use a flexgrid and just read and write values back and forth from Excel.
Re: Using a excel sheet in a form
I can't easaly edit, delete or insert rows, with flex grid...
Re: Using a excel sheet in a form
I've actually never tried this before, but I'm guessing that you would have to somehow get a reference to the Excel sheet and then use the Excel object model to interact with it. Can you post some more code or the project files?
Re: Using a excel sheet in a form
I don't have any code! I just put a shet in my form and now I want to find a way to get and put values and text in that sheet...
Re: Using a excel sheet in a form
I'm tired! I try many things without sucess!
Any trick?
Re: Using a excel sheet in a form
What version of Excel do you have? You can access a particualr cell like you posted using the Excel Object Model or you can show a sheet on a form using the OLE control.
to automate Excel...
VB Code:
Option Explicit
'Add a reference to ms excel xx.0 object library
Private sub command1_click()
dim oapp as excel.application
dim owb as excel.workbook
set oapp = new excel.application
set owb = oapp.workbooks.open("C:\MyFile.xls")
owb.sheets("sheet1").Cells(1,1) = "Test"
msgbox owb.sheets("sheet1").Cells(1,1)
owb.save
owb.close
set owb = nothing
oapp.quit
set oapp = nothing
End Sub
Re: Using a excel sheet in a form
I want to put a excel worksheet in my form.Is that possible with OLE. But I can't access it!
How can I do it?
Re: Using a excel sheet in a form
Put an OLE control on your form (OLE controls are found on your Toolbar) and link it to your spreadsheet.
Re: Using a excel sheet in a form
The OLE link should be either Linked or Embedded, only two choices. Once on your form, click on it to activate/Edit, etc. during run time.
Re: Using a excel sheet in a form
And, with a embebed sheet, how can I access, for example, at the cell(1,1)?
Re: Using a excel sheet in a form
AFAIK, you would have to invoke the double left clicking to create an instance of the embedded workbook first. I really dont get the reason you would want to show the workbook on a form embedded if you need to manipulate it programmatically?
Re: Using a excel sheet in a form
I need a table where the custumer can easaly edit, insert and remove rows. My idea is use a excel worksheet to do it.
Re: Using a excel sheet in a form
Warning: Thread Resurrection.
Did this ever get resolved? I need to do this too. I need to embed an Excel-like sheet into a Form and access it programatically.
Thanks!
Dave
1 Attachment(s)
Re: Using a excel sheet in a form
Sup Dave. You can use an Insertable Object called the "Microsoft Office Excel Worksheet". Its very similar to OLE but much better and updated.
Re: Using a excel sheet in a form
Right on, bro! Any idea how similar this interface is to the regular WorkSheet Object? Any docs on the subject?
Quote:
Originally Posted by RobDog888
Sup Dave. You can use an Insertable Object called the "Microsoft Office Excel Worksheet". Its very similar to OLE but much better and updated.
Re: Using a excel sheet in a form
So is there a way to access the Object programatically? Like can I get a Range out of it at run-time?