|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
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!! |
|
#2
|
|||
|
|||
|
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. |
![]() |
| Viewing: ASP Free Forums > Programming > Visual Basic Programming > VB6 and Excel |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|