Advice and integer and long advice required

smiler44

Registered User.
Local time
Today, 20:00
Joined
Jul 15, 2008
Messages
678
I have been having problems with a macro I wrote and seem today to have found the answer but I don't understand so am hoping for some advice.

I declared my variable as integer, gave it a value of 8 but as I stepped through the code I saw the figure via the immediate window held by the variable change from 8 to something like 546897 I cant recall the exact figure.

can you advise what is happening? when I declared the variable and long it remained 8.

thanks
smiler44
 
here is the code. It is not VBA code but comes from a program called Attachmate but I thought the skill base here is better suited to answereing the question.
The answer is dim as long not integer but why?


' Global variable declarations
Global g_HostSettleTime%
Global g_szPassword$

dim xpos as integer 'across
dim ypos as integer 'down
dim targget as string 'used to check if there is another ccup
dim counter as integer 'used to stop macro after x number ccups kicked
dim counter1 as integer ' used to tab down to the next ccup on daq page
dim counter2 as integer 'used with counter1




Sub Main()
'--------------------------------------------------------------------------------
' Get the main system object
Dim Sessions As Object
Dim System As Object
Set System = CreateObject("EXTRA.System") ' Gets the system object
If (System is Nothing) Then
Msgbox "Could not create the EXTRA System object. Stopping macro playback."
STOP
End If
Set Sessions = System.Sessions

If (Sessions is Nothing) Then
Msgbox "Could not create the Sessions collection object. Stopping macro playback."
STOP
End If
'--------------------------------------------------------------------------------
' Set the default wait timeout value
g_HostSettleTime = 300 ' milliseconds

OldSystemTimeout& = System.TimeoutValue
If (g_HostSettleTime > OldSystemTimeout) Then
System.TimeoutValue = g_HostSettleTime
End If

' Get the necessary Session Object
Dim Sess0 As Object
Set Sess0 = System.ActiveSession
If (Sess0 is Nothing) Then
Msgbox "Could not create the Session object. Stopping macro playback."
STOP
End If
If Not Sess0.Visible Then Sess0.Visible = TRUE
Sess0.Screen.WaitHostQuiet(g_HostSettleTime)

counter = 0
counter1 = 0
counter2 = 0
xpos = 8
ypos = 5 'across

end sub
 

Users who are viewing this thread

Back
Top Bottom