Excel spreadsheet within VB.Net?

frankwhite

Well-known member
Joined
Nov 30, 2004
Messages
49
Programming Experience
Beginner
Hi I was hoping somebody would be able to help me out with the following problem I am facing. Well basically I have worked with VB.NET Very little and require help with the following. In VB.NET I have a form in which I want to display some spreadsheets that I have created in Excel, something tells me that this is impossible but is there any way in which I can achieve this. For those who are confused with what I am asking, let me just break it down. I have an Excel Spreadsheet which I created, In all there are 6 sheets and each sheet has specific information. What I want is when the user runs the vb.net program, they can view the excel sheet within vb.net, however they cannot change the data within excel. But I want the same excel on another sheet where the User Can edit the data and if the data gets edited the sheet gets edited on the first form, I know this is confusing and some of you might be lost already but if anybody can help me and let me know if this is possible I would appreciate it.:(

Thanks a Million!!
 
Thanks for the reply, but just want to clarify something. What that has suggested is that opening a 'Office' document externally from VB.NET but I would of preferred opening the document within a Vb.Net Form, if you understand?
 
That is not correct. The AX control displays the document on form.
How did you get the impression it did not ?
 
Sorry buddy! Mis-understanding

But im sure that is not for vb.net but C++ instead.

APPLIES TO

•Microsoft Office XP Developer Edition•Microsoft Office 2000 Developer Edition•Microsoft Visual C++ 6.0 Professional Edition
 
It's an ActiveX control that you can put on your VB.Net form.

MORE INFORMATION

This sample shows Visual C++ developers how to construct an ActiveX control to act as an ActiveX document container, which allows developers to embed Office files for in-place editing and viewing. The control can then be used by Microsoft Visual Basic, Microsoft C#, or Web developers to view Office files inside their main solution, and give them programmatic control over the document while it is embedded.
 
Ive tried the following coding

Dim oDoc As Word.Document
Set oDoc = DsoFramer1.ActiveDocument
oDoc.Content.Text = "This was added by Automation"

But there is a problem, as it keeps saying the Word.Document is not defined, Also I thought i would have to change the "Word" to "Excel" but that does not work. The main problem is even with:
DsoFramer1.Open "C:\TestBook.xls" There is a problem and it cant recognise the "DsoFramer1"

Any help please?
 
You have
- installed the ActiveX on the system? (yes)
- one of the Office version installed on the system? (yes)
- added the control to VS Toolbox by browsing the COM tab?
- added the control from Toolbox to form? (and the instance is named that you say 'DsoFramer1'?)
- currently displaying a document (since you access the ActiveDocument property..)

If you got all these I don't know.
 
Well err I know i sound dumb but I did do the first two, but dont understand the rest, What do you mean? I know you get to the Com tab by clicking on "Add reference" then Im not sure after that. Im sorry if i sound stupid, its just I have not good knowledge of Vb.
 
No, not Add Reference, add control to Toolbox. You know, the place where you get the Labels, Textboxes and Buttons you add to form. Use context menu on this and choose "Add/Remove items..". In COM tab of that dialog you find and add the DSO control. When you have it in your Toolbox you add one control to form (just like a TextBox or Label or Button). The references the project needs to use this control will be added automatically.
 
Context menu displays when you right-click an item that has one associated. This is standard behaviour everywhere in the Windows operating system.

Just an opinion, I think anyone would be way over their head trying to program a system they don't even have the most basic understanding of how works. Perhaps you should take a course on how to operate a computer and get some thorough experience using it first? Then after a while come back and get into the real depths of the system with programming and creating applications that interact with this environment?
 
Back
Top