Hi AllI have an agent on production. The agent usually performs below operation
-
Reads a text file from NT folder
-
Copies the text in to a Word document template(coded with macro)
(word macro just converts the copied text to a tiff file.)
- Agent code run the macro in the word and places the tiff file in another NT folder.
The above agent runs fine on UAT but on production the agents creates word object and then stops. the word object does not get deleted and after some time server hangs unitll word object is manually deleted.
UAT and prod environments are in sync. this agent use to run fine on prod… since few days it is behaving strangely.
Can any one provide the solution.
Hi Wayne thanks of your advise
Here is the sub thats stopping agent to process further, the problem line ie preceeded by (***)
On Error Goto ErrorHasOccurred
Dim createcopy As String
Dim actualname
Dim extension As String
filepath=autoconfigdoc.Fieldname1(0)
backupfilepath=autoconfigdoc.backFieldname2(0)
(***) createcopy=Dir$(filepath,0)
Do While createcopy<>""
actualname=Strleft(createcopy,"_")+"_"+Strleft(Strright(createcopy,"_"),"_")
extension=Lcase(Strright(createcopy,"."))
Msgbox "===========>>>>>>>>>>>>>>>changefilename" & backupfilepath & actualname & "." & extension
Filecopy filepath+createcopy, backupfilepath+actualname+"."+extension
Kill filepath+createcopy
createcopy=Dir$(filepath,0)
Loop
Exit Sub
ErrorHasOccurred:
LogMessages= Cstr(Now()) & " ~ Error in agTCS_Mot_AS24 ~ Sub changefilename " & Erl() & " Error " & Error()
Call CreateLogEntry(Logmessages, "TCS/MOT/AS24","ERROR Log")
Exit Sub
Thanks in advance