Wrox Programmer Forums
|
Excel VBA Discuss using VBA for Excel programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Excel VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 8th, 2005, 09:57 AM
Authorized User
 
Join Date: Nov 2005
Posts: 19
Thanks: 1
Thanked 0 Times in 0 Posts
Default capture data from lpt1

Asumin i send a job of print from a CICS application directly to lpt1 (i have set the printer Generic Text) and have this result (see the attached file) is possible to caputure the job and import withoth save in a dir the job of print?
http:\\www.gssitaly.com\t8327.zip
in effect i use this macro to import the saved file:
'T8327 INPS
Sub CercaTrova()

Dim riga As String
Dim cont As Integer

cont = 4
FASE = 0
sott_int = 0

Dim Vfile
Vfile = Application.GetOpenFilename

Open Vfile For Input As #1

While Not EOF(1)
Line Input #1, riga

If Len(Trim(riga)) > 0 Then

If InStr(Mid(riga, 10, 9), "SPORTELLO") > 0 Then
var_DIP = Mid(riga, 22, 4)
FASE = 1
End If

If InStr(Mid(riga, 103, 1), ",") > 0 Then
var_SEDE = Mid(riga, 7, 4)
var_CAT = Mid(riga, 20, 3)
var_CERT = Mid(riga, 32, 8)
var_RATA = Mid(riga, 64, 2)
var_ANNO = Mid(riga, 70, 4)
var_IMPORTO = Mid(riga, 91, 15)
var_CC = Mid(riga, 125, 6)

FASE = 2
End If



If FASE = 2 Then
Foglio1.Range("A" & Trim(Str(cont))).Value = var_DIP
Foglio1.Range("B" & Trim(Str(cont))).Value = var_SEDE
Foglio1.Range("C" & Trim(Str(cont))).Value = var_CAT
Foglio1.Range("D" & Trim(Str(cont))).Value = var_CERT
Foglio1.Range("E" & Trim(Str(cont))).Value = var_RATA & "/" & var_ANNO
Foglio1.Range("F" & Trim(Str(cont))).Value = var_IMPORTO
Foglio1.Range("G" & Trim(Str(cont))).Value = var_CC
FASE = 0
cont = cont + 1

End If

End If
Wend
Close #1
MsgBox ("MACRO TERMINATA!")
End Sub







Similar Threads
Thread Thread Starter Forum Replies Last Post
capture data in datagridview stealthdevil Visual Basic 2005 Basics 0 January 23rd, 2008 06:49 PM
Capture and emaio formview control data nuttylife2 ASP.NET 1.x and 2.0 Application Design 0 August 1st, 2006 11:44 AM
capture check box data into mysql osemollie PHP How-To 0 January 30th, 2006 12:18 PM
Data capture apps for PDAs with VB.NET badgolfer VS.NET 2002/2003 2 September 3rd, 2005 08:55 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.