|
||||||
| Visual Basic Programming Discussion forum for Visual Basic, an event driven programming language and associated development environment from Microsoft for its COM programming model. |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
|
|||
|
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............. ![]() |
| Sponsored Links |
|
|
|
|||
|
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: |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| excel help (i THINK this could be easy...) | shackrock | General Programming | 1 | 07-11-2007 11:10 AM |
| ini files to excel spreadsheets | blondejamesblondeintaiwan | Visual Basic Programming | 1 | 05-27-2007 08:19 PM |
| Display an excel sheet | engr | ASP, ASP.NET and Coldfusion | 0 | 03-15-2007 12:00 AM |
| Exporting reports on excel sheet.. | reachpradeep | ASP, ASP.NET and Coldfusion | 0 | 03-03-2007 12:26 PM |
| Inserting Data into an Excel Spreadsheet | Lop | C# Programming | 3 | 06-27-2006 01:23 PM |
Goal: 100,000 Posts
Complete: 67%