.NET Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsProgramming.NET Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old June 24th, 2003, 09:56 PM
dbenoit64 dbenoit64 is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jun 2003
Posts: 1 dbenoit64 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Excel in ASP.NET

I have a bunch of code I got from someone written in a macro within Microsoft excel. the code takes data within cells from different sheets, does some calculations and writes out new data in a new sheet.<br><br>I have to move this to an ASP.NET page. However, Ive spent 10 - 12 hours already and I havent got anywhere.<br><br>These are my IMPORTS:<br>__________________________________<br>Option Explicit On <br>Imports System.Runtime.InteropServices.Marshal<br>Imports System.Math<br>Imports Excel<br>__________________________________<br><br>The bigest deal here apparently will be the input / output. Thats what will have to change the most im assuming.<br><br>I will be using the "Excel 10.0 Object Library". Just I cant get to the point where I actually specify the file name and open it for work. <br><br>I've tried code snippits from all over the web and nothing works. WHen I use this:<br><br>_____________________________________________<br> Dim xlApp As Excel.Application<br> Dim xlAppPID As Long<br> Dim xlWorkbooks As Excel.Workbooks<br> Dim xlWorkbook As Excel.Workbook<br> Dim xlSheet As Excel.Worksheet<br><br><br>and try to use these variables to open my file I get some error<br><br>_______________________________________________<br><br>this code:<br><br> xlApp = CType(CreateObject("Excel.Application"), Excel.Application)<br> xlsBook = CType(xlsApp.Workbooks.Add, Excel.Workbook)<br> xlsSheet = CType(xlsBook.Worksheets(1), Excel.Worksheet)<br><br>makes my page run infinitely<br><br>_______________________________________<br><br>whenever i use the new statment I get the error<br>"new cannot be used on an interface"<br><br>ie<br> Dim XL As New Excel.Application<br> Dim XlSheet As New Excel.Worksheet<br> If XL Is Nothing Then<br> MsgBox("Cant create excel object.")<br> Exit Sub<br> End If<br> Try<br> XlSheet = XL.Workbooks.Open(strXlFile).Worksheets("ToCollect")<br> Catch<br> MsgBox("Couldn't open or find :" & strXlFile & ". Error message = " & Err.Description & _<br> ". Error number = " & Err.Number)<br> XlSheet = Nothing<br> XL = Nothing<br> Return LocalArrayToSend<br> Exit Sub<br> End Try<br> strActivePhonenumber = XlSheet.Cells(4, 3).value<br><br> If XlSheet.Cells(8, 3).value = "v" Then<br> blCollectAnal1 = True<br> Else<br> blCollectAnal1 = False<br> End If<br><br> If XlSheet.Cells(9, 3).value = "v" Then<br> blCollectAnal2 = True<br> Else<br> blCollectAnal2 = False<br> End If<br><br>__________________________________________________ <br><br>If anyone is out there that has worked with excel I would really appreciate some help. Ive got 1 day left to get this done.<br><br>Im not exactly sure where to start but i know i need an instance of an object that points to my file so i can minipulate it with the vba code (that obvioulsy I have to conver [chang syntax here and there I suppose])<br><br>Thanks a lot<br><br>Dave

Reply With Quote
Reply

Viewing: ASP Free ForumsProgramming.NET Development > Excel in ASP.NET


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway
Stay green...Green IT