Lost Password?

Go Back   CodeCall Programming Forum > Software Development > Visual Basic Programming

Visual Basic Programming Discussion forum for Visual Basic, an event driven programming language and associated development environment from Microsoft for its COM programming model.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 06-28-2007, 03:36 AM
sania21 sania21 is offline
Newbie
 
Join Date: May 2007
Posts: 29
Rep Power: 5
sania21 is on a distinguished road
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.............
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Sponsored Links
  #2 (permalink)  
Old 06-30-2007, 02:45 AM
sqldud sqldud is offline
Newbie
 
Join Date: Apr 2007
Posts: 5
Rep Power: 0
sqldud is on a distinguished road
Default

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:
__________________
Cheers
SQLDUD

http://dotnetdud.blogspot.com/
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 07-02-2007, 05:41 AM
sania21 sania21 is offline
Newbie
 
Join Date: May 2007
Posts: 29
Rep Power: 5
sania21 is on a distinguished road
Default thanks !!!!

well!!!
thanks you for your kinda help i got my answer.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

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


All times are GMT -5. The time now is 07:13 PM.

Contest Stats

GoogleKeyw ........ 20.00000

Contest Rules

CodeCall Goal

Goal: 100,000 Posts
Complete: 67%

Ads