Closed Thread
Results 1 to 3 of 3

Thread: Help on Excel sheets!!!!!!!!!

  1. #1
    sania21 is offline Newbie
    Join Date
    May 2007
    Posts
    29
    Rep Power
    0

    Unhappy Help on Excel sheets!!!!!!!!!

    Hi all!!
    i am working on Excel Sheets ,what actualy i am doing is just taking the value from excel sheet doing some calculations on it and again passing the value which i get after calculation to a next row of same sheet but the problem i am getting is once i execute my program than i want to see the changes in the excel sheet but this time my excel sheet becomes read only and i cannot see any changes in the sheet as well please any one could explain me what is wrong in my code or what should be done to see the changes it will be realy helpfull....please...........i am great need of help.....


    Below shown is my code................




    HTML Code:
    Private Sub Form_Load()
    On Error GoTo er
    Dim xlTmp As Excel.Application
    Dim xlSht As New Excel.Worksheet
    Dim Wbk As New Excel.Workbook
    
    Dim xlRng As Excel.Range
    Dim xlRng1 As Excel.Range
    Dim xlRng2 As Excel.Range
    
    
    Dim i As Integer
    Dim k As Double
    Dim m, n, p As Double
    
    
      Set xlTmp = New Excel.Application
      xlTmp.DisplayAlerts = False
      xlTmp.Workbooks.Open ("D:\Write2.xls")
      Set WbkObj = GetObject("D:\Write2.xls")
      Set xlSht = xlTmp.Sheets(1)
      k = xlSht.UsedRange.Count
      'For i = 2 To i < k
            m = xlSht.Cells(2, 1)
            n = xlSht.Cells(2 + 1, 1)
            p = Log(n / m)
            xlSht.Cells(3, 2) = p
      'Next i
      WbkObj.Parent.Windows(WbkObj.Name).Visible = True
      WbkObj.Save
      xlTmp.Workbooks.Close
      Set xlSht = Nothing
      Set xlTmp = Nothing
    er:
      MsgBox ("error")
      MsgBox Err.Source & Err.Number & Err.Description
     
    End Sub
     

    i am totally confused with this.............

  2. CODECALL Circuit advertisement
    Join Date
    Always
    Posts
    Many

     
  3. #2
    sqldud is offline Newbie
    Join Date
    Apr 2007
    Posts
    5
    Rep Power
    0
    Just try to replace the code

    Set WbkObj = xlTmp.Workbooks.Open("D:\Write2.xls")
    ' Set WbkObj = GetObject("D:\Write2.xls") Commented By Shasur


    The quit would ensure that the excel will be closed
    xlTmp.Quit

    Set xlTmp = Nothing

    and also an Exit Sub before er:

    Exit Sub
    er:

  4. #3
    sania21 is offline Newbie
    Join Date
    May 2007
    Posts
    29
    Rep Power
    0

    thanks !!!!

    well!!!
    thanks you for your kinda help i got my answer.

Closed Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Excel 2007 and excel 2010
    By secondrate in forum Visual Basic Programming
    Replies: 1
    Last Post: 06-16-2010, 04:49 AM
  2. Import form Excel, filtr, export to excel
    By seatcordobawrc in forum Pascal and Delphi
    Replies: 1
    Last Post: 03-30-2010, 02:30 PM
  3. AS: External Style Sheets
    By chili5 in forum Tutorials
    Replies: 3
    Last Post: 09-01-2009, 10:07 AM
  4. using VB with excel
    By renoald in forum Visual Basic Programming
    Replies: 26
    Last Post: 10-20-2008, 09:52 AM
  5. Excel_macro: cells.find through few Sheets
    By arenduli in forum Visual Basic Programming
    Replies: 0
    Last Post: 09-25-2008, 06:58 AM

Tags for this Thread

Bookmarks

Posting Permissions

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