Hi

Could anyone please help me, I need to open an existing excel document using vb6. I only need to display the document.

Recommended Answers

All 8 Replies

Hi,

If only for Display, Simplest Way would be,

Place and OLE Control on the form and give options this way,

* Create New
* Object Type : Microsoft Excel Work Sheet

To Display,

Private Sub cmdShowExcl_Click()
OLE1.CreateLink "C:\MyExclSheet.xls"
End Sub

Regards
Veena

Hi,

In OLE Control, Insert Microsoft Word Document
Rest Remains the same

If u still have problems mail me

Regards
Veena

you mean open excel and load the document

isnt there an exce command?

something like:

exec("C:\Programs\Offise\Exel\" , "C:\Docs\Spreadsheet123\)

something like this worked in VB5 , google it

Shell

Hi,

Yes the code u r hunting for is,

AppActivate Shell("C:\Program Files\Microsoft Office\Office\Excel.exe C:\MySheet.xls", vbMaximizedFocus)


Regards
Veena

While this method will work, it is not the best way to go about doing it.... creating an object gives your application an infinite amount of control over the excel instance, whereas shelling excel only gives you control over opening it.

Hi veena

Thank you very much

Regards

Ravi

Hi,

In OLE Control, Insert Microsoft Word Document
Rest Remains the same

If u still have problems mail me

Regards
Veena

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.