Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

macro work only if the session is closed???

Status
Not open for further replies.

sal21

Programmer
Apr 26, 2004
434
IT
This macro work only if the session is closed???? Why?

Sub main
Dim max as long
dim nuovo as string
dim testo as string
dim lungh as integer
dim lunghezza as string
dim aggiung as integer
dim cambio as string

nuovo ="PrinterFilename"

Open "C:\Programmi\Attachmate\E!E2K\Sessions\CL151F4500_PRT.EPP" for input as #1
Max = LOF(1)


for i = 1 to max

seek 1,i

testo = input (15,#1)

if testo=nuovo then

seek 1,i

line input #1,lunghezza

lungh=len(lunghezza)

cambio=inputbox("nomefile")

nuovo="PrinterFilename="+cambio

exit for

end if


next i

close #1

Open "C:\Programmi\Attachmate\E!E2K\Sessions\CL151F4500_PRT.EPP" for append as #1

seek 1,i

aggiung=(lungh-len(nuovo))

nuovo=nuovo+space(aggiung)
print #1, nuovo

close #1

'=========================================================



nuovo ="PrinterWriteToFile"

Open "C:\Programmi\Attachmate\E!E2K\Sessions\CL151F4500_PRT.EPP" for input as #1
Max = LOF(1)


for i = 1 to max

seek 1,i

testo = input (18,#1)

if testo=nuovo then


nuovo="PrinterWriteToFile=1"

exit for

end if


next i

close #1

Open "C:\Programmi\Attachmate\E!E2K\Sessions\CL151F4500_PRT.EPP" for append as #1

seek 1,i



nuovo=nuovo
print #1, nuovo

close #1





end sub

 
If the session is open the file is locked by Extra. Therefore your macro can't execute the open for input line of code.

calculus
 
Tks for to post me.
But i have another question....
Is possible to set a proprety of session printer from VBA code, when the session .prt is opened?
For example set print on file, insert a name and path fromn this, select and unselect on file or on prinetr...
 
I don't understand your question entirely. Mostly because I don't do much with printing, but also because of your platform. I'm on E!PC (6.7) and you're on Extra for Win 2000 it looks like.

I'd guess that you should be able to create an object in VBA and set the properties for that object. This is very similar to using the SCREEN object for getting and putting information on the screen.

Have you tried adding a reference through VBA? To do this Tools>References and find Attachmate. From there you will be able to create your object and have a drop down list to choose from.

Good luck,

calculus
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top