CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Jan 2005
    Location
    Sydney
    Posts
    23

    Unhappy Please dont laugh it hurts, just back up your files

    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

  2. #2
    Join Date
    Jul 2005
    Posts
    14

    Re: Please dont laugh it hurts, just back up your files

    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

  3. #3
    Join Date
    Feb 2005
    Location
    Israel
    Posts
    1,475

    Re: Please dont laugh it hurts, just back up your files

    In VB.NET the code looks like this
    Code:
    Dim MyXl As Excel.Application = New  Excel.Application 
    Dim MyBook As Excel.Workbook = m_MyXl.Workbooks.Open(fileName)

  4. #4
    Join Date
    Jan 2005
    Location
    Sydney
    Posts
    23

    Red face Re: Please dont laugh it hurts, just back up your files

    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured