Macro Excel - Thunderbird para envio de correo

El propósito de este foro es ayudar o comentar cosas sobre migrar entre programas y sistemas operativos, incluyendo lo que respecta a los productos Mozilla.
Aguazal
Recién llegado
Recién llegado
Mensajes: 1
Registrado: Jue May 17, 2007 3:49 am

Macro Excel - Thunderbird para envio de correo

Mensaje por Aguazal » Jue May 17, 2007 4:23 am

Hola.

Estoy cambiando del Outlook al Thunderbird y me ha surgido un problema. Tengo una macro en un archivo excel para enviar correos a direcciones que están en ese archivo excel y que funciona con el Outlook. El asunto es que no tengo ni idea de como hacer que esa macro funcione con el Thunderbird, es decir, como hacer una macro nueva. Está que pongo aquí la modifiqué y la adapté a mis necesidades.

Este es el código de la macro que tengo con el Outlook para enviar correo desde el excel:

'--- Set up the Outlook objects.
Dim objOutlook As Outlook.Application
Dim objOutlookMsg As Outlook.MailItem
Dim objOutlookRecip As Outlook.Recipient
Dim objOutlookAttach As Outlook.Attachment
'--- Declare our global variables to be used in each subroutine.
Dim CustomerAddress As String
Dim CustomerMessage As String
Sub MailItNow()
'--- Declare our variables.
Dim X As Integer
Dim TempCustomerAddress As String
'--- Prevent screen redraws until the macro is finished.
Application.ScreenUpdating = False
'--- Sort the addresses and names alphabetically, by the e-mail address.
'--- This is REQUIRED to prevent any duplicate addresses from
' receiving more than one e-mail.
Columns("A:U").Select
Selection.Sort Key1:=Range("I2"), Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
'--- Sets which row to start searching for e-mail addresses and names.
X = 2
'--- Begin looping through all the e-mail addresses in column A until
' a blank cell is hit.
While Range("I" & X).Text <> ""
'--- These variables will be used to search for duplicates.
CustomerAddress = Range("I" & X).Text
TempCustomerAddress = CustomerAddress
'--- Increment X until a different e-mail address is found.
While TempCustomerAddress = CustomerAddress
X = X + 1
CustomerAddress = Range("I" & X).Text
Wend
'--- Add the e-mail address to a global variable.
CustomerAddress = Range("I" & X - 1).Text
'--- Add a message with the user's name to the e-mail.
'--- Customize your own message and closing here.
CustomerMessage = Range("D" & X - 1).Text & vbCrLf _
& Range("E" & X - 1).Text & vbCrLf _
& "Tel." & Range("G" & X - 1).Text & vbCrLf _
& Range("F" & X - 1).Text & " " & Range("C" & X - 1).Text & vbCrLf & vbCrLf _
& " xxxxxxxxxx" & vbCrLf & vbCrLf _
& " xxxxxxxxxx" & vbCrLf _











'--- Run the subroutine to send the message.
Call SendMessage
Wend
End Sub
Sub SendMessage(Optional AttachmentPath)
'--- This is required to prevent a name which does not resolve to
' an e-mail address from hanging the app.
On Error Resume Next
' Create the Outlook session.
Set objOutlook = CreateObject("Outlook.Application")
' Create the message.
Set objOutlookMsg = objOutlook.CreateItem(olMailItem)
With objOutlookMsg
' Add the To recipient(s) to the message.
Set objOutlookRecip = .Recipients.Add(CustomerAddress)
objOutlookRecip.Type = olTo
' Set the Subject, Body, and Importance of the message.
.Subject = "xxxxxxxxxx"
.Body = CustomerMessage
.Attachments.Add ("C:\Documents and Settings\aqui esta todo\Mis documentos\Solicitud.pdf")
.Importance = olImportanceHigh 'High importance
' Add attachments to the message.
If Not IsMissing(AttachmentPath) Then
Set objOutlookAttach = .Attachments.Add(AttachmentPath)
End If
' Resolve each Recipient's name.
For Each objOutlookRecip In .Recipients
objOutlookRecip.Resolve
If Not objOutlookRecip.Resolve Then
Exit Sub
End If
Next
.Send '--- Send the message.
End With
'--- Remove the message and Outlook application from memory.
Set objOutlookMsg = Nothing
Set objOutlook = Nothing
End Sub

fco1340@yahoo.com.mx

Re: Macro Excel - Thunderbird para envio de correo

Mensaje por fco1340@yahoo.com.mx » Mar Ene 15, 2008 7:35 pm

Hola

Yo tengo el mismo problema, espero puedas informarse si te pudierón ayudar sobre el tema ya que necesito también enviar mensajes desde el Excel por medio del thunderbird

Gracias

.....@yahoo.com.mx´
Aguazal escribió:Hola.

Estoy cambiando del Outlook al Thunderbird y me ha surgido un problema. Tengo una macro en un archivo excel para enviar correos a direcciones que están en ese archivo excel y que funciona con el Outlook. El asunto es que no tengo ni idea de como hacer que esa macro funcione con el Thunderbird, es decir, como hacer una macro nueva. Está que pongo aquí la modifiqué y la adapté a mis necesidades.

Este es el código de la macro que tengo con el Outlook para enviar correo desde el excel:

'--- Set up the Outlook objects.
Dim objOutlook As Outlook.Application
Dim objOutlookMsg As Outlook.MailItem
Dim objOutlookRecip As Outlook.Recipient
Dim objOutlookAttach As Outlook.Attachment
'--- Declare our global variables to be used in each subroutine.
Dim CustomerAddress As String
Dim CustomerMessage As String
Sub MailItNow()
'--- Declare our variables.
Dim X As Integer
Dim TempCustomerAddress As String
'--- Prevent screen redraws until the macro is finished.
Application.ScreenUpdating = False
'--- Sort the addresses and names alphabetically, by the e-mail address.
'--- This is REQUIRED to prevent any duplicate addresses from
' receiving more than one e-mail.
Columns("A:U").Select
Selection.Sort Key1:=Range("I2"), Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
'--- Sets which row to start searching for e-mail addresses and names.
X = 2
'--- Begin looping through all the e-mail addresses in column A until
' a blank cell is hit.
While Range("I" & X).Text <> ""
'--- These variables will be used to search for duplicates.
CustomerAddress = Range("I" & X).Text
TempCustomerAddress = CustomerAddress
'--- Increment X until a different e-mail address is found.
While TempCustomerAddress = CustomerAddress
X = X + 1
CustomerAddress = Range("I" & X).Text
Wend
'--- Add the e-mail address to a global variable.
CustomerAddress = Range("I" & X - 1).Text
'--- Add a message with the user's name to the e-mail.
'--- Customize your own message and closing here.
CustomerMessage = Range("D" & X - 1).Text & vbCrLf _
& Range("E" & X - 1).Text & vbCrLf _
& "Tel." & Range("G" & X - 1).Text & vbCrLf _
& Range("F" & X - 1).Text & " " & Range("C" & X - 1).Text & vbCrLf & vbCrLf _
& " xxxxxxxxxx" & vbCrLf & vbCrLf _
& " xxxxxxxxxx" & vbCrLf _











'--- Run the subroutine to send the message.
Call SendMessage
Wend
End Sub
Sub SendMessage(Optional AttachmentPath)
'--- This is required to prevent a name which does not resolve to
' an e-mail address from hanging the app.
On Error Resume Next
' Create the Outlook session.
Set objOutlook = CreateObject("Outlook.Application")
' Create the message.
Set objOutlookMsg = objOutlook.CreateItem(olMailItem)
With objOutlookMsg
' Add the To recipient(s) to the message.
Set objOutlookRecip = .Recipients.Add(CustomerAddress)
objOutlookRecip.Type = olTo
' Set the Subject, Body, and Importance of the message.
.Subject = "xxxxxxxxxx"
.Body = CustomerMessage
.Attachments.Add ("C:\Documents and Settings\aqui esta todo\Mis documentos\Solicitud.pdf")
.Importance = olImportanceHigh 'High importance
' Add attachments to the message.
If Not IsMissing(AttachmentPath) Then
Set objOutlookAttach = .Attachments.Add(AttachmentPath)
End If
' Resolve each Recipient's name.
For Each objOutlookRecip In .Recipients
objOutlookRecip.Resolve
If Not objOutlookRecip.Resolve Then
Exit Sub
End If
Next
.Send '--- Send the message.
End With
'--- Remove the message and Outlook application from memory.
Set objOutlookMsg = Nothing
Set objOutlook = Nothing
End Sub


[Editado] Eliminado email.

Responder