LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 62
Default How to debug class ?

How to debug a class ? Like below module, Need to update debug.print
statement in class. It is good method ?

Public mail As New clsMail

Public Sub Send()
On Error GoTo errHand
With mail
.init_me
.Process_File <== Program stop here
End With
Exit Sub
errHand:
MsgBox "Modules: Mail, Public Sub Send" & Chr(13) & _
VBA.Str(Err.Number) & " " & Err.Description, vbCritical

End Sub

clsMail

.....
Sub Process_File()
Dim FN As String ' For File Name
Dim Msg As String
Dim lochkBillto As Integer
Dim k As Variant
Dim StateDate As Variant
Dim loStateDateText As String
Dim kfn As String
Dim loSheet As Variant

Dim ThisRow As Long
Dim MediaFileLocation As String
Msg = ""
Application.ScreenUpdating = False
'MediaFileLocation = "c:\YOURFOLDER\*.YOURFILEEXTENSION"
MediaFileLocation = Statement_Dir + "\*_*.xls"
'~~ MsgBox Statement_Dir
FN = Dir(MediaFileLocation)
Debug.Print "FN=" & FN
Do Until FN = ""
ThisRow = ThisRow + 1
'~~Cells(ThisRow, 1) = FN
k = VBA.Split(FN, ".", -1, vbTextCompare)
'~~ 454386_yyyymmdd.xls
StateDate = VBA.Split(k(0), "_", -1, vbTextCompare)
'~~MsgBox "StateDate " & StateDate(1)
kfn = StateDate(0)
Debug.Print "kfn=" & kfn
loStateDateText = StateDate(1)
Debug.Print "loStatDateText=" & StateDate(1)
'~~MsgBox "Bill to " & k(0)
Debug.Print "Control_name=" & Control_NAME

lochkBillto = Search_Billto(Control_NAME, mailtoSheet, kfn)
Debug.Print "Bill-to=" & lochkBillto
Debug.Print "mailtosheet=" & mailtoSheet
If lochkBillto 0 Then
'~~ Get Information
Set loSheet =
Application.Workbooks(Control_NAME).Sheets(mailtoS heet)
Process_flg = VBA.Left(VBA.UCase(loSheet.Cells(lochkBillto,
2)), 1)
Debug.Print "Process_flg = " & Process_flg
If Process_flg = "Y" Then
StateDateText = ChangeDateEnglish(loStateDateText)
Company = loSheet.Cells(lochkBillto, 3)
Mailto = loSheet.Cells(lochkBillto, 4)
cc = loSheet.Cells(lochkBillto, 5)
If VBA.Trim(Mailto) = "" And VBA.Trim(cc) = "" Then
'~~MsgBox "blank found"
Mailto = EmailAddress
End If
'~~MsgBox "Mailto " & Mailto
cntFileSend = cntFileSend + 1
Application.StatusBar = "Processing ... " &
Statement_Dir & "\" & FN & " , " & _
"Number of file = " & cntFileSend
Call Send_mail(Statement_Dir, FN)
'~~ Move file
kill_file (History_Dir & "\" & FN)
Name Statement_Dir & "\" & FN As History_Dir & "\" & FN
End If
End If
FN = Dir
Loop
Application.ScreenUpdating = True
MsgBox "Number of Files sent = " & cntFileSend
End Sub

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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
Class programming - how to return chartobject from a class? [email protected] Excel Programming 3 October 11th 06 12:07 PM
Class modules: parametrize class object fields Jean-Pierre Bidon Excel Programming 11 August 31st 06 02:49 PM
help with debug Jim May Excel Programming 2 August 10th 04 01:04 PM
RaiseEvent from a class contained in a 2nd class collection? Andrew[_16_] Excel Programming 2 January 6th 04 04:22 PM
debug help Tom Ogilvy Excel Programming 0 August 27th 03 07:10 PM


All times are GMT +1. The time now is 07:17 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"