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.............![]()
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:
well!!!
thanks you for your kinda help i got my answer.![]()
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks