Strange Problem with excel 2003 compared to excel 2000 in using theboolean variable

Y

Yuvraj

Hi I am facing a strange issue where though the boolean value of
condition is true but still the code does not go inside the function
of uploading the zipped files from my Temp directory to File Server: I
am always passing the value of IsuseZIP As true.

The sample code is as follows:

The code where

Public Function uploadTest(ByVal targetFilenameTest As String,
Optional wbTest As Variant, _
Optional CSVTest As Boolean = False, _
Optional IsuseZIP As Boolean = False) As
Boolean

Dim l_localFilename As String
Dim l_localZIPname As String
Dim l_targetZIPname As String
Dim l_strZipCmd As String
Dim l_myWSH As IWshShell_Class
'***************************************************************************************
'Arch Beg
Dim api As New clsAPI
'Arch End
'***************************************************************************************

If IsuseZIP = True Then
l_localFilename = m_strTempDir & cstrZIPcandidate
l_localZIPname = m_strTempDir & "abcd.zip"
l_targetZIPname = Replace(targetFilenameTest , ".xls", ".zip")
Else
l_localFilename = m_strTempDir & timeName()
End If
If IsMissing(wb) Then Set wb = ThisWorkbook


wb.SaveCopyAs l_localFilename
End
If
'*
If IsuseZIP Then
On Error Resume Next
Kill l_localZIPname
On Error GoTo 0

'***************************************************************************************
'Arch Beg


ZipXP l_localZIPname, l_localFilename


fInfo.msg = "Data compressed. Now uploading. Please wait..."
End If

connectToServer
If IsuseZIP Then
uploadTest= FtpPutTheFile(m_lngConnectionID,
l_localZIPname, l_targetZIPname, _
TEST FTP_BINARY_XFR, 0)

Else

uploadTest= FtpPutTheFile(m_lngConnectionID, l_localFilename,
l_targetFilename, _
TESTFTP_BINARY_XFR, 0)

End If

On Error Resume Next
If saveAsCSV And Not wb Is ThisWorkbook Then wb.Close
SaveChanges:=False '*
Kill l_localFilename
Kill l_localZIPname
On Error GoTo 0

disconnectFromServer
End Function



Problem Defination: If I debug and press F8 and then go line by line
value of uploadTest is True which is returned, but if just press F5
from the start of the function and go directly to the end of function
uploadTest value is returned False. I do not understand this strange
behaviour.

For Reference I am putting the code of FtpPutTheFile

Private Declare Function FtpPutTheFile Lib "wininet.dll" Alias
"FtpPutTheFileA" _
(ByVal tstFtpSession As Long, _
ByVal tstlpszLocalFile As String, _
ByVal tstlpszRemoteFile As String, _
ByVal tstdwFlags As Long, _
ByVal tstdwContext As Long) As Boolean


So guys what and where it is going wrong and how to identify the
difference between pressing F8 and going one by one where it gets
activated and not gets activated when we directly hits F5.

Regards,

Yuvraj
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top