Click to See Complete Forum and Search --> : Please dont laugh it hurts, just back up your files


nickj
July 17th, 2005, 02:43 AM
I feel like a twat for asking and telling you all this but I have to…

After reformatting my Hard drive because of a &#%^ worm or something and not backing up my VB.Net files(I know, I know…) I lost all me notes/code on a project I was working on.
For now I need the code for opening an excel file from a button on a form, the excel file has already been created I just cant find the code to open the file from a click of a button

Dim MyXl As Excel.Application
Dim MyBook As Excel.Workbook
Dim MySheet As Excel.Worksheet
???????("C:\,,,\Mydoc.xls")

Quick tip for all that read this…
Back up your files…. NOW or loose 2 months of coding (and considering I’m a beginner at this, it hurts even more)

Thanks guys

scorpion1983
July 18th, 2005, 06:25 AM
HI
Have a Nice Day

First of all download the S/q to recover Data Truely its very Good
www.phazeddl.com
and Download FINAL DATA 2 OK

Now ur solution for openiung Excel

Set objExcel = CreateObject("Excel.Application")
Set objWorkbook = objExcel.Workbooks.Open("C:\a.xls")

Wait For Ur Acknoledgement
Best Regards
Scorpion

jhammer
July 18th, 2005, 07:31 AM
In VB.NET the code looks like this

Dim MyXl As Excel.Application = New Excel.Application
Dim MyBook As Excel.Workbook = m_MyXl.Workbooks.Open(fileName)

nickj
July 18th, 2005, 08:39 AM
ok guys for some reason the code opens my.xls and book1. i have no need for book1 at all. Here is the code

Dim MyXl As Excel.Application
Dim MyBook As Excel.Workbook
Dim MySheet As Excel.Worksheet
MyXl = CreateObject("Excel.Application")
MyBook = MyXl.Workbooks.Open("C:\stoploss.xls")
MyXl.Visible = True
MyXl.Workbooks.Add()



'populate cells
MyXl.Cells(2, 2).Value = ASXTb.Text

End Sub


Thanks for your help guys