Pagina precedente | 1 | Pagina successiva
Vota | Stampa | Notifica email    
Autore

[RISOLTO] Inviare un fax da excel

Ultimo Aggiornamento: 19/04/2024 12:55
Post: 1.986
Registrato il: 27/07/2010
Utente Veteran
OFFLINE
17/04/2024 17:19

Ci sono un po' di errori in quel codice, ma correggendoli potrebbe funzionare.

Il punto è che c'è un prerequisito da soddisfare: tra i dispositivi del tuo computer è presente un server fax?
Io no ce l'ho e non posso testare il codice, quindi mi sono limitato a correggere quello che potevo, ovvero togliere gli errori che impedivamo la compilazione del codice.

A runtime ovviamente, non avendo un server fax, il codice va in errore (connessione al server fax).

N.B.: non ho intenzione di studiarmi la schedulazione, né altre cose, quindi non penso di intervenire ulteriormente.

Di seguito il codice modificato, ti lascio l'onere di studuare e sistemare lato server fax:

fax
'https://learn.microsoft.com/fr-fr/previous-versions/windows/desktop/fax/-mfax-sending-a-fax
Private Sub Form_Load()
    'mettere i riferimenti alla libreria Microsoft Fax Service Extended COM Type Library

    Dim objFaxDocument As FaxDocument
    Dim objFaxServer As FaxServer
    Dim objSender As Object
    Dim JobId As Variant

    'Error handling
    On Error GoTo Error_Handler

    Set objFaxServer = New FaxServer
    Set objFaxDocument = New FaxDocument

    'Connect to the fax server
    objFaxServer.Connect ""

    'Set the fax body
    objFaxDocument.Body = "c:\Docs\Body.txt"

    'Name the document
    objFaxDocument.DocumentName = "My First Fax"

    'Set the fax priority
    objFaxDocument.Priority = FAXCOMEXLib.FAX_PRIORITY_TYPE_ENUM.fptHIGH


    'Add the recipient with the fax number 12225550100
    objFaxDocument.Recipients.Add "12225550100", "Bud"

    'Choose to attach the fax to the fax receipt
    objFaxDocument.AttachFaxToReceipt = True

    'Set the cover page type and the path to the cover page
    objFaxDocument.CoverPageType = FAXCOMEXLib.FAX_COVERPAGE_TYPE_ENUM.fcptSERVER
    objFaxDocument.CoverPage = "generic"

    'Provide the cover page note
    objFaxDocument.Note = "Here is the info you requested"

    'Provide the address for the fax receipt
    objFaxDocument.ReceiptAddress = "someone@example.com"

    'Set the receipt type to email
    objFaxDocument.ReceiptType = FAXCOMEXLib.FAX_RECEIPT_TYPE_ENUM.frtMAIL

    'Specify that the fax is to be sent at a particular time
    objFaxDocument.ScheduleType = FAXCOMEXLib.FAX_SCHEDULE_TYPE_ENUM.fstNOW
    'CDate converts the time to the Date data type
    'objFaxDocument.ScheduleTime = CDate("5:01:47 PM")

    objFaxDocument.Subject = "Today's fax"

    'Set the sender properties.
    objFaxDocument.Sender.Title = "Mr."
    objFaxDocument.Sender.Name = "Bob"
    objFaxDocument.Sender.City = "Cleveland Heights"
    objFaxDocument.Sender.State = "Ohio"
    objFaxDocument.Sender.Company = "Microsoft"
    objFaxDocument.Sender.Country = "USA"
    objFaxDocument.Sender.Email = "someone@microsoft.com"
    objFaxDocument.Sender.FaxNumber = "12165555554"
    objFaxDocument.Sender.HomePhone = "12165555555"
    objFaxDocument.Sender.OfficeLocation = "Downtown"
    objFaxDocument.Sender.OfficePhone = "12165555553"
    objFaxDocument.Sender.StreetAddress = "123 Main Street"
    objFaxDocument.Sender.TSID = "Office fax machine"
    objFaxDocument.Sender.ZipCode = "44118"
    objFaxDocument.Sender.BillingCode = "23A54"
    objFaxDocument.Sender.Department = "Accts Payable"

    'Save sender information as default
    objFaxDocument.Sender.SaveDefaultSender

    'Submit the document to the connected fax server
    'and get back the job ID.

    'objFaxDocument.ConnectedSubmit objFaxServer
    JobId = objFaxDocument.Submit("test")

    MsgBox "The Job ID is :" & JobId


    objFaxServer.Disconnect

    Exit Sub

Error_Handler:
    'Implement error handling at the end of your subroutine. This
    ' implementation is for demonstration purposes
    MsgBox ("Error number: " & Hex(Err.Number) & ", " & Err.Description)

End Sub

[Modificato da scossa 17/04/2024 17:21]

Bye!
scossa

scossa's web site
___
Se tu hai una mela, e io ho una mela, e ce le scambiamo, allora tu ed io abbiamo sempre una mela per uno. Ma se tu hai un'idea, ed io ho un'idea, e ce le scambiamo, allora abbiamo entrambi due idee. (George Bernard Shaw)
Vota:
Amministra Discussione: | Riapri | Sposta | Cancella | Modifica | Notifica email Pagina precedente | 1 | Pagina successiva
Nuova Discussione
 | 
Rispondi
Cerca nel forum
Tag discussione
Discussioni Simili   [vedi tutte]
Feed | Forum | Bacheca | Album | Utenti | Cerca | Login | Registrati | Amministra
Tutti gli orari sono GMT+01:00. Adesso sono le 10:18. Versione: Stampabile | Mobile | Regolamento | Privacy
FreeForumZone [v.6.1] - Copyright © 2000-2024 FFZ srl - www.freeforumzone.com