I have some problem. It all works on my dev.computer but when I test on new computer I get errors...

I have Excel 2007 insalled whit the same version on both computers.
It works perfect on my dev.computer.

What could I have missed?

 Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click

    End Sub

    ' Initera Excel och korrekt excel fil
    Private Sub Init_excel()

        On Error Resume Next
        objApp = GetObject(, "Excel.Application")
        If Err.Number <> 0 Then
            objApp = CreateObject("Excel.Application")
        End If
        objBook = objApp.Workbooks.Open("C:\b\Report.xls")

    End Sub

 Private objApp As Object, objBook As Object

    ' Find last row then write
    Private Sub Write_To_Excel()
        With objBook.sheets("Blad1")

            Dim sistaraden As Integer

            LastROW = objBook.sheets("Blad1").Range("a1").End(-4121).Row
            LastROW = LastROW

            ' data
            .cells(LastROW + 1, 1).Value = '99'
            .cells(LastROW + 1, 2).Value = '909'
            .cells(LastROW + 1, 3).Value = "gfgf"
            .cells(LastROW + 1, 4).Value = FLroduurs
            .cells(LastROW + 1, 5).Value = FonMies
            .cells(LastROW + 1, 6).Value = FLurs
            .cells(LastROW + 1, 7).Value = Furs
            .cells(LastROW + 1, 8).Value = X_Alates
            .cells(LastROW + 1, 9).Value = aties
            .cells(LastROW + 1, 10).Value = ister
            .cells(LastROW + 1, 11).Value = F_cy

            End With

        Catch ex As Exception

        End Try

    End Sub

Open in new window

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

NorieAnalyst Assistant Commented:
Where in the code do you get the problem?
kavvisAuthor Commented:
I should be at line 24

"   Private Sub Write_To_Excel()
Only place I have the try catch..

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
NorieAnalyst Assistant Commented:
Are you sure the path and filename are correct?

When I tested the code I accidentally put the file in the wrong folder and received the message you did.

I only found out after I stepped through the code using F11.

By the way, it should be double quotes around values, not single quotes.
     .cells(LastRow + 1, 1).Value = "99"
     .cells(LastRow + 1, 2).Value = "909"

Open in new window

kavvisAuthor Commented:
Mybad... hade wrong Framework... thank you that you took your time..
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.