Usted está aquí: Inicio Dokumentazio Irekia Manuales Hylafax : servidor de faxes en software libre Mailing por fax desde el mismo cliente
Acciones de Documento

Mailing por fax desde el mismo cliente

Nota: Ésta es la vista de impresión del Manual de referencia completo en una sola página. Si lo prefiere puede encontrar la versión original aquí.

Si en tu empresa soléis mandar / recibir faxes hylafax podría ser vuestra solución.

1. Requisitos para poder hacerlo

Si queremos hacer un mailing por fax desde el servidor, debemos de cumplir los siguientes requisitos
  • Cliente WHFC instalado en el equipo. La impresora que hemos instalado debe llamarse “hylafax”, sino no funcionará esto
  • Microsoft Word / Excel (pruebas hechas con 97 y 2000 y va OK)
  • El campo de combinación que contiene el nº de fax, debe llamarse “fax”

2. Combinación de Word

Antes de nada tenemos que tener el documento Word que queremos que sea el fax.

word01.jpg

Además tenemos que tener el Documento Excel desde donde sacaremos los datos de las empresas a las que queremos enviar el fax.

word02.jpg

En Word tenemos que indicarle que nos coja los datos de este fichero. Para ello, tenemos lo siguiente : Herramientas: Combinar Correspondencia
word03.jpg
Y le elegimos el fichero Excel donde están los datos de las empresas.

3. Macro a añadir en Word

Ahora nos falta el tema más peliagudo. Tenemos que crear una macro.

Podemos hacerlo de diferentes formas. Modificar la plantilla normal.dot del equipo, con lo que todos los documentos creados con dicho ordenador incluirían la macro, o crear una plantilla especial y luego crear los documentos de tipo mailing apartir de dicha plantilla especial. Esto a gusto de consumidor.

La macro a añadir en cuestión es la siguiente

Sub MergeFax()
'
' MergeFax Macro
' Macro created 08/11/98 by Keith Gray
' Modified for full-blown Mailmerge 10/30/00 by Michael DeWitt
'
' This version will create a mailmerge with output for each record to be merged and produce a PS file suitable for Hylafax. The script
' was tested with word97 sr-1.  Consider the first page of your merge document to be the cover page. The number of pages might be able to
'be determined in VBA, but I just type it into the body of the document (since all of the faxes are the same length.
' How to use this script:
'1. Create your mailmerge document
'2. Run the mailmerge script setting your main document and data source.
'3. Modify the line setting datafields("fax") to be the correct name of the fax number field in your merge document.
'4. Make sure that the merge document is the "active" document (if you have other documents open in Word).
'5. call your hylafax printer (created for WHFC) "hylafax" or modify the name in the script below. (it needn't be this printer, but why create another PS Printer?

'It is important to note that the WHFC does not support killtime as of yet and so if you are sending a lot of faxes, you may find that some of them are are killed before
'they even get a chance to be sent.  In a dual modem hylafax server, sending a 6 page fax, 5-6 faxes were aborted before they had a chance to be
'sent.

Dim whfc As Object
Dim OLE_Return As Long
Dim faxnum As String
Dim SpoolFile As String

Dim Template As String
Dim Tempfile As String
Dim mergedfile As String
Dim Title As String
Dim WhfcPrinter As String
Dim Default_Active_Printer As String
Dim Box_Return As Integer
' MsgBox ActiveDocument.Name
ActiveDocument.MailMerge.ViewMailMergeFieldCodes = True
ActiveDocument.MailMerge.DataSource.ActiveRecord = wdLastRecord
Numb_Faxes = ActiveDocument.MailMerge.DataSource.ActiveRecord
ActiveDocument.MailMerge.DataSource.ActiveRecord = wdFirstRecord
Template = ActiveDocument.Name

For I = 1 To Numb_Faxes

SpoolFile = Environ("Temp") & "\fax" & I & ".ps"

Title = "WHFC Mail Merge to Fax Macro( Version 1.1 )"

faxnum = ActiveDocument.MailMerge.DataSource.DataFields("fax") '<===Change
"fax" to be the correct name of the fax number field


With ActiveDocument.MailMerge
    .DataSource.FirstRecord = I
    .DataSource.LastRecord = I
    .Destination = wdSendTofile
    .SuppressBlankLines = True
    .Execute
End With


' MsgBox ActiveDocument.Name
Tempfile = ActiveDocument.Name
WhfcPrinter = "Hylafax"
Default_Active_Printer = ActivePrinter
'MsgBox ActivePrinter
ActivePrinter = WhfcPrinter$

'Note: background must be false in order to work - this is do to some kind
of bug in VBA

Application.PrintOut FileName:="", Range:=wdPrintAllDocument, _
    Item:=wdPrintDocumentContent, Copies:=1, Pages:="", _
    PageType:=wdPrintAllPages, Collate:=True, Background:=False, _
    PrintToFile:=True, OutputFileName:=SpoolFile, Append:=False

  Set whfc = CreateObject("WHFC.OleSrv")
  OLE_Return = whfc.SendFax(SpoolFile, faxnum, True)
  ' MsgBox OLE_Return 'if you activate this you will see the fax job number
from hylafax.
  If OLE_Return <= 0 Then
    Box_Return = MsgBox("Error sending file", 16, Title)
  Else
    'Box_Return = MsgBox(OLE_Return, 0, Title)
  End If
  Set whfc = Nothing
 
Documents(Tempfile).Close (False)
Documents(Template).Activate
ActiveDocument.MailMerge.DataSource.ActiveRecord = wdNextRecord
Next I

ActivePrinter = Default_Active_Printer$
End Sub

Tenemos que tener alguna cosa en cuenta. La impresora que hemos añadido al instalar el cliente de hylafax, tiene que llamarse “hylafax” para que esta macro funcione.
Y otra cosilla más: el campo en Excel que contiene el nº de fax, debe llamarse “fax”, sino habría que cambiar la macro.

4. ¿Cómo meter la macro en el documento?

Tenemos que ir al documento y crear la macro.

 Para ello Herramientas: Macro: Macros.

macro01.jpg

Le damos a Crear:
macro02.jpg
Y nos llevará al editor de Visual Basic. Pegamos ahí el código de la macro y listo


macro03.jpg



5. ¿Cómo ejecutar la macro?

Qué tenemos que hacer para hacer el lanzamiento final del mailing

Una vez tenemos todo esto hecho, tan solo queda ejecutar la macro, para ello Herramientas: Macro: Macros:

macro04.jpg
Y empezará el proceso de lanzar faxes.


macro05.jpg



Recomienda al IMH

Anuncios Google
Zerikasi
Zerikasi: Aprendizaje a lo largo de la vida
Gobierno Vasco - Departamento de Educación, Universidades e Investigación. Ir a su web
Ciclos Formativos - Heziketa Zikloak
Ciclos Formativos - Heziketa Zikloak
Contacto

IMH en las Redes Sociales
Siguenos en Twitter Siguenos en Facebook Siguenos en Tuenti Siguenos en Linkedin Siguenos en nuestro canal de Youtube Siguenos en Flickr Siguenos en SlideShare
Ingenieria en Alternancia en las Redes Sociales
Siguenos en Twitter Siguenos en Facebook Siguenos en nuestro canal de Youtube Siguenos en Tuenti Follow us on Flickr Follow us on Picasa