Hola a Todos,
quiero crear una dll para utilizarla luego para imprimir
he encontrado este código pero no me funciona :
Código:
'VERSION 1.0 CLASS
BEGIN
MultiUse = -1 'True
Persistable = 0 'NotPersistable
DataBindingBehavior = 0 'vbNone
DataSourceBehavior = 0 'vbNone
MTSTransactionMode = 0 'NotAnMTSObject
End
Attribute VB_Name = "cPrint"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
Public Sub EndDocPrint()
Printer.EndDoc
End Sub
Public Sub NextPagePrint()
Printer.NewPage
End Sub
Public Sub skipline(numb As Integer)
Printer.Font.Name = "draft 17cpi"
For i = 1 To numb
Printer.Print
Next
End Sub
Public Sub Pattern()
'======7==============22==================42========================== ==72==================92=========103===========================
' XXXXXXXXXX XXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXX 9,9999 9,999,999.99
'Printer.CurrentY = (chrlen * 164)
'Printer.Currentx = (chrlen * 132)
End Sub
Public Sub PrintRPHeading(SupCode As String, SupDesc As String, PO As String, SupInv As String, InvDate)
Printer.Font.Name = "draft 17cpi"
spacing = Printer.TextHeight("A") * 0.25
charlen = Printer.TextWidth("=")
'
skipline (2)
'
CO = "<UNKNOWN COMPANY>"
y = Printer.CurrentY
Printer.CurrentX = ((charlen * 132) - Printer.TextWidth(CO)) / 2
Printer.Print CO
'
y = Printer.CurrentY + spacing
Title = "Receiving Purchases"
Printer.CurrentY = y
Printer.CurrentX = ((charlen * 132) - Printer.TextWidth(Title)) / 2
Printer.Print Title
'
skipline (3)
'
y = Printer.CurrentY + spacing
Printer.CurrentY = y
Printer.CurrentX = (charlen * 1)
Printer.Print "Supplier: "; SupCode; " "; SupDesc
'
Printer.CurrentY = y
Printer.CurrentX = (charlen * 116)
Printer.Print "Date: "; Format(Now(), "yyyy/mm/dd")
'
y = Printer.CurrentY + spacing
Printer.CurrentY = y
Printer.CurrentX = (charlen * 1)
Printer.Print "PO: "; PO
'
y = Printer.CurrentY + spacing
Printer.CurrentY = y
Printer.CurrentX = (charlen * 1)
Printer.Print "Supplier Invoice: "; SupInv; " ", InvDate
'
y = Printer.CurrentY + spacing
Printer.CurrentY = y
Printer.CurrentX = (charlen * 1)
Printer.Print String(132, "=")
'
y = Printer.CurrentY + spacing
Printer.CurrentY = y
Printer.CurrentX = (charlen * 1)
Printer.Print " Brand Model Description Serial/Batch Qty Cost"
'
y = Printer.CurrentY + spacing
Printer.CurrentY = y
Printer.CurrentX = (charlen * 1)
Printer.Print String(132, "-")
End Sub
Public Sub PrintRPDetail(Brand As String, Model As String, Desc As String, Serial As String, Qty As String, Cost As String)
Printer.Font.Name = "draft 17cpi"
spacing = Printer.TextHeight("A") * 0.25
charlen = Printer.TextWidth("=")
'
y = Printer.CurrentY + spacing
Printer.CurrentY = y
Printer.CurrentX = (charlen * 7)
Printer.Print Brand
'
Printer.CurrentY = y
Printer.CurrentX = (charlen * 22)
Printer.Print Model
'
Printer.CurrentY = y
Printer.CurrentX = (charlen * 42)
Printer.Print Desc
'
Printer.CurrentY = y
Printer.CurrentX = (charlen * 72)
Printer.Print Serial
'
Printer.CurrentY = y
Printer.CurrentX = (charlen * 97)
Printer.Print Qty
'
Printer.CurrentY = y
Printer.CurrentX = (charlen * 103)
Printer.Print Cost
End Sub
Public Sub PrintRPFooterDetail(Qty As String, Total_Cost As String)
Printer.Font.Name = "draft 17cpi"
spacing = Printer.TextHeight("A") * 0.25
charlen = Printer.TextWidth("=")
'
y = Printer.CurrentY + spacing
Printer.CurrentY = y
Printer.CurrentX = (charlen * 72)
Printer.Print String(40, "-")
'
y = Printer.CurrentY + spacing
Printer.CurrentY = y
Printer.CurrentX = (charlen * 72)
Printer.Print "Total Cost..."; " ", Qty; " "; Total_Cost
End Sub
Public Sub PrintRPFooter()
Printer.Font.Name = "draft 17cpi"
spacing = Printer.TextHeight("A") * 0.25
charlen = Printer.TextWidth("=")
'
y = Printer.CurrentY
'
Printer.CurrentY = (charlen * 160)
Printer.CurrentX = (charlen * 1)
Printer.Print "Received By: Recorded By: Noted By:"
'
skipline (1)
'
y = Printer.CurrentY + spacing
Printer.CurrentY = y
Printer.CurrentX = (charlen * 1)
Printer.Print "_________________________ _________________________ _________________________"
y = Printer.CurrentY + spacing
Printer.CurrentY = y
Printer.CurrentX = (charlen * 1)
Printer.Print "Remarks:"
'
Printer.CurrentY = y
Printer.CurrentX = (charlen * 10)
Printer.Print String(122, "_")
'
y = Printer.CurrentY + spacing
Printer.CurrentY = y
Printer.CurrentX = (charlen * 1)
Printer.Print String(132, "_")
'
y = Printer.CurrentY + spacing
Printer.CurrentY = y
Printer.CurrentX = (charlen * 1)
Printer.Print String(132, "_")
End Sub
La verdad es que soy un principiante con visual basic y necesito urgenetemente poder crear esta dll
En los pasos para utlizarla me pone que las siguiente variables:
Código:
MultiUse = -1 'True
Persistable = 0 'NotPersistable
DataBindingBehavior = 0 'vbNone
DataSourceBehavior = 0 'vbNone
MTSTransactionMode = 0 'NotAnMTSObject
las tengo que declarar en "details Section have to be Declared"
yo lo he puesto en GENERAL DECLARACIONES , pero al crearla me da un error:
eror en la compilaicon : El procedimiento externo no es válido...
Alguien puede ayudarme?