Visual Basic Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsProgrammingVisual Basic Programming

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 May 4th, 2005, 03:21 AM
juhu juhu is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: May 2005
Posts: 1 juhu User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 m 40 sec
Reputation Power: 0
VB6 and Excel

i am getting frustrated with this component and bought a VBA book that did not help at all.
can some one please tell me what the hell i'm doing wrong with this code.

Dim oExcel As New Excel.Application
Dim WB As New Excel.Workbook

Set oExcel = New Excel.Application

Set WB = oExcel.Workbooks.Open(FileName:=FileNm, ReadOnly:=True)

'WB.Sheets("Mailer").Select

count = 1
WB.Sheets("Mailer").Range("1:1").Select
WB.Sheets("Mailer").Range("1:1").Font.Bold = True
WB.ActiveSheet.Cells(count, 1) = "Application Date"
WB.ActiveSheet.Cells(count, 2) = "Applicant Name"
WB.ActiveSheet.Cells(count, 3) = "Student Name"
WB.ActiveSheet.Cells(count, 4) = "Applicant ID Number"
WB.ActiveSheet.Cells(count, 5) = "Student Number"
WB.ActiveSheet.Cells(count, 6) = "Application Number"
WB.ActiveSheet.Cells(count, 7) = "Student Loan Amount"
WB.ActiveSheet.Cells(count, 8) = "Student Approved Loan Amount"
WB.ActiveSheet.Cells(count, 9) = "Sub Institution"
WB.ActiveSheet.Cells(count, 10) = "Current Status"
WB.ActiveSheet.Cells(count, 11) = "Empirica Score"
WB.ActiveSheet.Cells(count, 12) = "Status Date"
WB.ActiveSheet.Cells(count, 13) = "Elmacs Account Numbers"
WB.ActiveSheet.Cells(count, 14) = "Status Note"
WB.ActiveSheet.Cells(count, 15) = "Cell Number"
WB.ActiveSheet.Cells(count, 16) = "Employer"

While Not RS.BOF And Not RS.EOF

count = count + 1
WB.ActiveSheet.Columns("A:A").EntireColumn.AutoFit
WB.ActiveSheet.Cells(count, 1) = DFormat(RS!ApplDt)
WB.ActiveSheet.Columns("A:A").EntireColumn.AutoFit
WB.ActiveSheet.Cells(count, 2) = DFormat(RS!ApplSurname) + ", " + DFormat(RS!ApplName)
WB.ActiveSheet.Columns("B:B").EntireColumn.AutoFit
WB.ActiveSheet.Cells(count, 3) = DFormat(RS!ApplSurname) + ", " + DFormat(RS!StudName)
WB.ActiveSheet.Columns("C:C").EntireColumn.AutoFit
WB.ActiveSheet.Cells(count, 4) = RS!ApplIDNO
WB.ActiveSheet.Columns("C:C").EntireColumn.AutoFit
WB.ActiveSheet.Cells(count, 5) = DFormat(RS!StudNo)
WB.ActiveSheet.Columns("C:C").EntireColumn.AutoFit

None of the bloody column resize font fomat or megre cell functions want to work. This is the only way to open and close
Excel in VB6 without it continuously running in the background. please HELP ME!!

Reply With Quote
  #2  
Old May 4th, 2005, 08:32 AM
Darius Darius is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Sep 2004
Posts: 108 Darius User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 11 h 16 m 54 sec
Reputation Power: 5
What is this?,Did you junked an aplication to make your own?

No problem I do it my self, but as far as I know DFormat doesn't exist in excel nor in your code.

I can paste code but as the old saying stated "Help to fish, not give a fish"

Excel is a nap, just take advantage of its facilities. Excel has the facility to record a macro (Menu tools- Macro - Record New Macro)
A small flying button will appear on the screen to stop the recording, in this moment start doing whatever selections, change of formats, sorting, even chart making, at the end of the changes press the stop button. This not end here, you need to see the macro and change the code (almost as junking an application) at your needs with the desired flexibility.

From there a new ball game will be, if you try this and you still can't, I can post some code but please try, it will open the Excel's full capability.

Reply With Quote
Reply

Viewing: ASP Free ForumsProgrammingVisual Basic Programming > VB6 and Excel


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 3 hosted by Hostway
Stay green...Green IT