Saltar al contenido
PROGRAMAR EN VBA MACROS DE EXCEL

Como Filtrar Cliente Rango Fechas Enviar Mail Yahoo con PDF Adjunto #489

Enviar Mail desde Excel con Yahoo

 

En este ejemplo verás como filtrar en excel por cliente rango de fechas generar reporte adjuntar PDF y enviar por mail con Yahoo

La macro permite hacer un filtro de excel en la base de datos mostrando los datos en el listbox de Excel VBA, se puede filtrar por un cliente y adicionarle un filtro entre fechas, se puede crear un informe en excel con los datos del listbox, generar un PDF con el reporte y enviarlo por correo electrónico utilizando YAHOO.

Para manejar Excel en forma eficiente haz click acá, si quieres aprender sobre Excel, en inglés, entonces debes hacer click here. Si lo que necesitas es aprender o profundizar sobre la programación de macros con VBA este es unos de los mejores cursos on line que he visto en internet, te lo recomiendo no te arrepentirás.

Como funciona el ejemplo que envía correo en excel con yahoo

Para comprende mejor el ejemplo es preciso que se descargue el ejemplo desde el final del post; resumiendo se puede decir que la macro de excel permite filtrar en excel una base de datos, el filtro se puede realizar por Cliente y rango de fechas si se requiere, o directamente entre fechas, realizado el filtro los datos coincidentes se mostrará en el listbox que se encuentre en el formulario.

Luego se puede generar un reporte o informe con los datos contenidos en el listbox, ese reporte se genera en PDF, el cual se adjunta, para luego enviar correo en excel , utilizando YAHOO.

Quizás sea de utilidad:

Como enviar mail desde Excel con Outlook con mensaje en el cuerpo del correo

Como enviar desde Excel mail con link o hipertexto

 

Explicación de la codificación de Excel – VBA para filtar excel generar reporte adjuntar PDF y enviar por Correo Yahoo

En post anteriores se mostró en detalle como filtrar por cliente por lo que sugiero ver entre otros los siguientes  Como filtrar Por Cliente y Rango de FechasComo filtrar Por Cliente y Rango de Fechas y totalizar en listbox.

En este post se pone más énfasis en explicar como generar un reporte, crear un PDF con los datos filtrados y luego enviar por mail el Reporte utilizando YAHOO.

Es preciso habilitar ciertas referencias en el editor de VBA, para ello siga la figura siguiente y habilite las referencias,  debes ir al Editor de VBA (Alt + F11), seleccionar el menú Herramientas luego Referencias y constata que tengas las mismas referencias que la imagen siguiente, si no las tienes búscalas y tilda para habilitar la referencia.

 

Para enviar mail desde Excel con Yahoo, primero se crear el reporte se apela a una hoja temporal de Excel, en el cual se crea el reporte y se le da cierto formato, esto se logra presionando el botón de color morado que dice Yahoo.

El reporte se crea con los datos del listbox, es decir se pasan datos del listbox a la hoja de Excel, de la siguiente forma, previo crea la hoja temporal

ActiveWorkbook.Sheets.Add After:=Worksheets(Worksheets.Count)
ActiveSheet.name = «Reporte»
Set a = Sheets(«Reporte»)

For x = 1 To UserForm1.ListBox1.ListCount – 5
a.Cells(x + 2, «A») = ListBox1.List(x, 0)
a.Cells(x + 2, «B») = CDate(ListBox1.List(x, 1))
a.Cells(x + 2, «C») = ListBox1.List(x, 2)
a.Cells(x + 2, «D») = ListBox1.List(x, 3)
a.Cells(x + 2, «E») = ListBox1.List(x, 4)
a.Cells(x + 2, «F») = ListBox1.List(x, 5)
a.Cells(x + 2, «G») = CDec(ListBox1.List(x, 6))
Next

Luego da ciertos formatos como agregado de encabezados, ancho de columna, ancho automático, formato de numero con separador de miles, formato de fecha, etc., se usan los siguientes códigos entre otros.

a.Range(«G2:G» & uf).NumberFormat = «#.#,0»
a.Range(«B2:B» & uf).NumberFormat = «dd/mm/yyyy»
a.Range(«A:G»).Columns.AutoFit
a.Range(«A:A»).ColumnWidth = 31

Posteriormente se crea el archivo PDF que tendrá el mismo nombre que el libro Excel con la macro pero con extensión PDF, se usan los códigos siguientes:

sn = ActiveSheet.name
mydoc = ThisWorkbook.Path & «\» & sn & «.pdf»
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:=mydoc, Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:=False

 

Paso Siguiente la macro de excel procede a envíar el mail utilizando YAHOO, antes se explicó utilizando GMAIL, para ello establece el destinatario que lo obtiene del textbox donde ingresamos el mail, establece el servidor SMTP saliente para poder enviar el mail, se configura el puerto, es importante que en la parte de autenticación modifiques la macro agregando tu nombre de correo y contraseña, debes modificar lo resaltado en letra roja y dice «TU CORREO YAHOO» Y «TU CLAVE«

Set Email = New CDO.Message
Email.Configuration.Fields(cdoSMTPServer) = «smtp.mail.yahoo.com»
Email.Configuration.Fields(cdoSendUsingMethod) = 2
Email.Configuration.Fields.Item(«http://schemas.microsoft.com/cdo/configuration/smtpserverport») = CLng(25) ‘yahoo
Email.Configuration.Fields.Item(«http://schemas.microsoft.com/cdo/» & «configuration/smtpauthenticate») = Abs(1)
Email.Configuration.Fields.Item(«http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout») = 30
Auten = True
If Auten Then
Email.Configuration.Fields.Item(«http://schemas.microsoft.com/cdo/configuration/sendusername») = «TUCORREO» ‘ej «marcrodos@yahoo.es» aqui debes agregar tu correo entre comillas
Email.Configuration.Fields.Item(«http://schemas.microsoft.com/cdo/configuration/sendpassword») = «TuPASSWORD«
Email.Configuration.Fields.Item(«http://schemas.microsoft.com/cdo/configuration/smtpusessl») = True

End If

Email.To = Dest
Email.From = «TU CORREO» ‘Aca debes agregar el correo desde donde se envía es decir el mismo usaro para loguearse en yahoo
Email.Subject = «Reporte de Movimientos»
Email.TextBody = «Estimado, en el archivo adjunto se encuentra el reporte de los últimos movimientos de su cuenta, confirmar recepción»
Email.AddAttachment mydoc
Email.Configuration.Fields.Update
Email.Send

Con el código anterior se envía el mail, paso siguiente se elimina el archivo PDF creado, si no se desea eliminar simplemente comentar (colocando apostrofe (‘) delante o borrar el comando, además de eliminar la hoja temporal, así:

Kill mydoc

a.Delete

Código de VBA – Excel que permite enviar mail desde excel utilizando yahoo con PDF Adjunto

Seguidamente se muestra todo el código contenido en el ejemplo, y posteriormente el link de descarga del ejemplo.

Código que se inserta en formulario Excel – VBA

Private Sub CommandButton1_Click()
Unload Me
End Sub

Private Sub CommandButton2_Click()
On Error Resume Next
Set b = Sheets(«Hoja1»)
uf = b.Range(«A» & Rows.Count).End(xlUp).Row
dato1 = CDate(TextBox2)
dato2 = CDate(TextBox3)
If dato2 = Empty Or dato1 = emtpy Then
MsgBox («Debe ingresar datos para consulta entre rango de fechas»), vbCritical, «AVISO»
Exit Sub
End If
If dato2 < dato1 Then
MsgBox («La fecha final no puede ser mayor a la fecha inicial»), vbCritical, «AVISO»
Exit Sub
End If

b.AutoFilterMode = False
Me.ListBox1 = Clear
Me.ListBox1.RowSource = Clear

‘Adiciona un item al listbox reservado para la cabecera
UserForm1.ListBox1.AddItem

If dato1 = Empty Or dato2 = Empty Then

For i = 2 To uf
dato0 = CDate(b.Cells(i, 2).Value)
If dato0 >= dato1 And dato0 <= dato2 Then
Me.ListBox1.AddItem b.Cells(i, 1)
Me.ListBox1.List(Me.ListBox1.ListCount – 1, 1) = b.Cells(i, 2)
Me.ListBox1.List(Me.ListBox1.ListCount – 1, 2) = b.Cells(i, 3)
Me.ListBox1.List(Me.ListBox1.ListCount – 1, 3) = b.Cells(i, 4)
Me.ListBox1.List(Me.ListBox1.ListCount – 1, 4) = b.Cells(i, 5)
Me.ListBox1.List(Me.ListBox1.ListCount – 1, 5) = b.Cells(i, 6)
Me.ListBox1.List(Me.ListBox1.ListCount – 1, 6) = b.Cells(i, 7)
End If
Next i

Else

If dato2 < dato1 Then
MsgBox («La fecha final no puede ser mayor a la fecha inicial»), vbCritical, «AVISO»
Exit Sub
End If

For i = 2 To uf
strg = b.Cells(i, 1).Value
dato0 = CDate(b.Cells(i, 2).Value)
If UCase(strg) Like UCase(TextBox1.Value) & «*» And dato0 >= dato1 And dato0 <= dato2 Then
Me.ListBox1.AddItem b.Cells(i, 1)
Me.ListBox1.List(Me.ListBox1.ListCount – 1, 1) = b.Cells(i, 2)
Me.ListBox1.List(Me.ListBox1.ListCount – 1, 2) = b.Cells(i, 3)
Me.ListBox1.List(Me.ListBox1.ListCount – 1, 3) = b.Cells(i, 4)
Me.ListBox1.List(Me.ListBox1.ListCount – 1, 4) = b.Cells(i, 5)
Me.ListBox1.List(Me.ListBox1.ListCount – 1, 5) = b.Cells(i, 6)
Me.ListBox1.List(Me.ListBox1.ListCount – 1, 6) = b.Cells(i, 7)
End If
Next i

End If

‘Carga los datos de la cabecera en listbox
For ii = 0 To 7
UserForm1.ListBox1.List(0, ii) = Sheets(«Hoja1»).Cells(1, ii + 1)
Next ii

UserForm1.ListBox1.AddItem
UserForm1.ListBox1.AddItem
UserForm1.ListBox1.AddItem
UserForm1.ListBox1.List(UserForm1.ListBox1.ListCount – 1, 0) = «Total Importe»

For x = 0 To UserForm1.ListBox1.ListCount – 1
t = CDec(UserForm1.ListBox1.List(x, 6))
tot = tot + t
t = 0
Next x
UserForm1.ListBox1.List(UserForm1.ListBox1.ListCount – 1, 1) = Format(tot, » «»U$S»» #,##0.00 «)

UserForm1.ListBox1.AddItem
UserForm1.ListBox1.List(UserForm1.ListBox1.ListCount – 1, 0) = «Total de registros:»
UserForm1.ListBox1.List(UserForm1.ListBox1.ListCount – 1, 1) = UserForm1.ListBox1.ListCount – 5

Me.ListBox1.ColumnWidths = «170 pt;70 pt;50 pt;50 pt;50 pt;50 pt;50 pt»
End Sub

Private Sub CommandButton3_Click()
Unload UserForm1
End Sub

Private Sub CommandButton4_Click()
Application.ScreenUpdating = False
Application.DisplayAlerts = False
On Error Resume Next

Dim Email As CDO.Message, Auten As Boolean, Dest As String, mydoc As String

If TextBox4 = Empty Then
MsgBox («Debe ingresar mail»), vbCritical, «AVISO»
Exit Sub
End If

ActiveWorkbook.Sheets.Add After:=Worksheets(Worksheets.Count)
ActiveSheet.name = «Reporte»
Set a = Sheets(«Reporte»)

For x = 1 To UserForm1.ListBox1.ListCount – 5
a.Cells(x + 2, «A») = ListBox1.List(x, 0)
a.Cells(x + 2, «B») = CDate(ListBox1.List(x, 1))
a.Cells(x + 2, «C») = ListBox1.List(x, 2)
a.Cells(x + 2, «D») = ListBox1.List(x, 3)
a.Cells(x + 2, «E») = ListBox1.List(x, 4)
a.Cells(x + 2, «F») = ListBox1.List(x, 5)
a.Cells(x + 2, «G») = CDec(ListBox1.List(x, 6))
Next

a.Cells(x + 4, «A») = ListBox1.List(x + 2, 0)
a.Cells(x + 5, «A») = ListBox1.List(x + 3, 0)
a.Cells(x + 4, «B») = ListBox1.List(x + 2, 1)
a.Cells(x + 5, «B») = ListBox1.List(x + 3, 1)

a.Activate
a.Range(«A1») = «REPORTE DE VENTAS»

With a.Range(«A1:G1»)
.Merge
.VerticalAlignment = xlCenter
.HorizontalAlignment = xlCenter
.RowHeight = 20
.Font.Size = 16
End With

a.Range(«A2») = «CLIENTE»
a.Range(«B2») = «FECHA»
a.Range(«C2») = «COMPROBANTE»
a.Range(«D2») = «TIPO»
a.Range(«E2») = «SUC»
a.Range(«F2») = «N COMP»
a.Range(«G2») = «IMPORTE»
uf = a.Range(«G» & Rows.Count).End(xlUp).Row
a.Range(«G2:G» & uf).NumberFormat = «#.#,0»
a.Range(«B2:B» & uf).NumberFormat = «dd/mm/yyyy»
a.Range(«A:G»).Columns.AutoFit
a.Range(«A:A»).ColumnWidth = 31

sn = ActiveSheet.name
mydoc = ThisWorkbook.Path & «\» & sn & «.pdf»
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:=mydoc, Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:=False
Dest = Me.TextBox4

Set Email = New CDO.Message
Email.Configuration.Fields(cdoSMTPServer) = «smtp.mail.yahoo.com»
Email.Configuration.Fields(cdoSendUsingMethod) = 2
Email.Configuration.Fields.Item(«http://schemas.microsoft.com/cdo/configuration/smtpserverport») = CLng(25) ‘yahoo
Email.Configuration.Fields.Item(«http://schemas.microsoft.com/cdo/» & «configuration/smtpauthenticate») = Abs(1)
Email.Configuration.Fields.Item(«http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout») = 30
Auten = True
If Auten Then
Email.Configuration.Fields.Item(«http://schemas.microsoft.com/cdo/configuration/sendusername») = «TUCORREO» ‘ej «marcrodos@yahoo.es» aqui debes agregar tu correo entre comillas
Email.Configuration.Fields.Item(«http://schemas.microsoft.com/cdo/configuration/sendpassword») = «TuPASSWORD»
Email.Configuration.Fields.Item(«http://schemas.microsoft.com/cdo/configuration/smtpusessl») = True

End If

Email.To = Dest
Email.From = «TU CORREO» ‘Aca debes agregar el correo desde donde se envía es decir el mismo usaro para loguearse en yahoo
Email.Subject = «Reporte de Movimientos»
Email.TextBody = «Estimado, en el archivo adjunto se encuentra el reporte de los últimos movimientos de su cuenta, confirmar recepción»
Email.AddAttachment mydoc
Email.Configuration.Fields.Update
Email.Send

If Err.Number = 0 Then
MsgBox «El mail con archivo adjunto fue enviado con éxito», vbInformation, «AVISO»
Else
MsgBox «Se produjo el siguiente error: » & Err.Description, vbCritical, «Error nro » & Err.Number
End If

Kill mydoc
a.Delete
Sheets(«Hoja1»).Select
Application.DisplayAlerts = True
Application.ScreenUpdating = True
End Sub

Private Sub Label2_Click()
TextBox4.SetFocus
End Sub

Private Sub ListBox3_Click()
On Error Resume Next

UserForm1.TextBox4 = Empty
fila = UserForm1.ListBox3.ListIndex

UserForm1.TextBox4 = UserForm1.ListBox3.List(fila, 1)

UserForm1.ListBox3.Visible = False

If TextBox4 = Empty Then
UserForm1.Label2.Visible = True ‘hace visible el label
Else
UserForm1.Label2.Visible = False
End If

If TextBox8 = Empty Then
UserForm1.Label1.Visible = True ‘hace visible el label
Else
UserForm1.Label1.Visible = False
End If
Me.CommandButton4.SetFocus
End Sub

Private Sub TextBox1_Change()
On Error Resume Next
Set b = Sheets(«Hoja1»)
uf = b.Range(«A» & Rows.Count).End(xlUp).Row
If Trim(TextBox1.Value) = «» Then
Me.ListBox1.RowSource = «Hoja1!A1:G» & uf
Exit Sub
End If

b.AutoFilterMode = False
Me.ListBox1 = Clear
Me.ListBox1.RowSource = Clear
dato1 = CDate(TextBox2)
dato2 = CDate(TextBox3)
‘Adiciona un item al listbox reservado para la cabecera
UserForm1.ListBox1.AddItem

For i = 2 To uf
strg = b.Cells(i, 1).Value
If UCase(strg) Like UCase(TextBox1.Value) & «*» Then
Me.ListBox1.AddItem b.Cells(i, 1)
Me.ListBox1.List(Me.ListBox1.ListCount – 1, 1) = b.Cells(i, 2)
Me.ListBox1.List(Me.ListBox1.ListCount – 1, 2) = b.Cells(i, 3)
Me.ListBox1.List(Me.ListBox1.ListCount – 1, 3) = b.Cells(i, 4)
Me.ListBox1.List(Me.ListBox1.ListCount – 1, 4) = b.Cells(i, 5)
Me.ListBox1.List(Me.ListBox1.ListCount – 1, 5) = b.Cells(i, 6)
Me.ListBox1.List(Me.ListBox1.ListCount – 1, 6) = b.Cells(i, 7)
End If
Next i

‘Carga los datos de la cabecera en listbox
For ii = 0 To 7
UserForm1.ListBox1.List(0, ii) = Sheets(«Hoja1»).Cells(1, ii + 1)
Next ii

UserForm1.ListBox1.AddItem
UserForm1.ListBox1.AddItem
UserForm1.ListBox1.AddItem
UserForm1.ListBox1.List(UserForm1.ListBox1.ListCount – 1, 0) = «Total Importe»

For x = 0 To UserForm1.ListBox1.ListCount – 1
t = CDec(UserForm1.ListBox1.List(x, 6))
tot = tot + t
t = 0
Next x
UserForm1.ListBox1.List(UserForm1.ListBox1.ListCount – 1, 1) = Format(tot, » «»U$S»» #,##0.00 «)

UserForm1.ListBox1.AddItem
UserForm1.ListBox1.List(UserForm1.ListBox1.ListCount – 1, 0) = «Total de registros:»
UserForm1.ListBox1.List(UserForm1.ListBox1.ListCount – 1, 1) = UserForm1.ListBox1.ListCount – 5

UserForm1.TextBox2 = Clear
UserForm1.TextBox3 = Clear

Me.ListBox1.ColumnWidths = «170 pt;70 pt;50 pt;50 pt;50 pt;50 pt;50 pt»
End Sub

Private Sub TextBox2_Change()
If Len(UserForm1.TextBox2) = 10 Then UserForm1.TextBox3.SetFocus
End Sub

Private Sub TextBox3_Change()
If Len(UserForm1.TextBox3) = 10 Then UserForm1.CommandButton2.SetFocus
End Sub

Private Sub TextBox4_Change()
Application.ScreenUpdating = False
Application.DisplayAlerts = False
On Error Resume Next
Dim cn As ADODB.Connection, rs As ADODB.Recordset

If TextBox4 = Empty Then
UserForm1.Label2.Visible = True ‘hace visible el label
Else
UserForm1.Label2.Visible = False
End If

If Len(UserForm1.TextBox4) <= 2 Then
UserForm1.ListBox3.Visible = False
Exit Sub
Else
UserForm1.ListBox3.Visible = True
End If

Set cn = New ADODB.Connection
Set rs = New ADODB.Recordset
Set a = Sheets(«Agenda»)

cn.Open «Provider=Microsoft.ACE.OLEDB.12.0;» & «Data Source=» & ThisWorkbook.FullName & «;Extended Properties=»»Excel 12.0;HDR=Yes;»»»

If Len(UserForm1.TextBox4) > 2 Then
Sql = «SELECT * FROM [» & «Agenda$» & «] WHERE Ucase(» & a.Range(«A1») & «) LIKE Ucase(‘%» & UserForm1.TextBox4 & «%’) ORDER BY Nombre ASC»
Set rs = cn.Execute(Sql)

UserForm1.ListBox3.Clear

If rs.EOF = True Then
rs.Close
Set rs = Nothing
cn.Close
Set cn = Nothing
UserForm1.ListBox3.Visible = False
Exit Sub
Else

UserForm1.ListBox3.Column = 3
UserForm1.ListBox3.ColumnWidths = «70 pt;100 pt;80 pt»

rs.MoveFirst
Do While Not rs.EOF
UserForm1.ListBox3.AddItem rs.Fields(0).Value
UserForm1.ListBox3.List(UserForm1.ListBox3.ListCount – 1, 1) = rs.Fields(1).Value
UserForm1.ListBox3.List(UserForm1.ListBox3.ListCount – 1, 2) = rs.Fields(2).Value
rs.MoveNext
Loop
End If

End If
Set rs = Nothing
cn.Close
Set cn = Nothing

‘Si solo hay un dato coincidente directamente lo busca y carga sus datos, al seleccionarlo se ejecuta el evento click del listbox
If UserForm1.ListBox3.ListCount – 1 = 0 Then
UserForm1.ListBox3.Selected(0) = True
UserForm1.ListBox3.Visible = False
End If
Application.ScreenUpdating = True
Application.ScreenUpdating = True
End Sub

Private Sub UserForm_Initialize()
Dim fila As Long
Application.DisplayAlerts = False
Application.ScreenUpdating = False
Set b = Sheets(«Hoja1»)
uf = b.Range(«A» & Rows.Count).End(xlUp).Row
uc = b.Cells(1, Columns.Count).End(xlToLeft).Address
wc = Mid(uc, InStr(uc, «$») + 1, InStr(2, uc, «$») – 2)
With Me.ListBox1
.ColumnCount = 7
.ColumnWidths = «170 pt;50 pt;50 pt;50 pt;50 pt;50 pt;50 pt»
.RowSource = «Hoja1!A1:» & wc & uf
End With
Application.DisplayAlerts = True
Application.ScreenUpdating = True
End Sub
Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
On Error GoTo Fin
If CloseMode <> 1 Then Cancel = Tru
Fin:
End Sub

Function TableHTML() As String
Dim col As Long, fil As Long
canfil = ActiveSheet.UsedRange.Rows.Count
cancol = ActiveSheet.UsedRange.Columns.Count
stable = «<Div><table>»
For f = 1 To canfil
stable = stable & «<tr>»
For c = 1 To cancol
stable = stable & «<td>» & Cells(f, c) & » </td>»
Next c
stable = stable & «</tr>»
Next f
stable = stable & «</table> <br><br><br><br><br></Div>»
TableHTML = stable
End Function

Código que se inserta en un módulo de Excel – VBA

#If VBA7 And Win64 Then
‘Si es de 64 bits
Public Declare PtrSafe Function ShellExecute Lib «shell32.dll» Alias «ShellExecuteA» (ByVal hwnd As LongPtr, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As LongPtr
Public Declare PtrSafe Function FindWindow Lib «USER32» Alias «FindWindowA» (ByVal lpClassName As String, ByVal lpWindowName As String) As LongPtr
Public Declare PtrSafe Function GetWindowLongPtr Lib «USER32» Alias «GetWindowLongPtrA» (ByVal hwnd As LongPtr, ByVal nIndex As Long) As LongPtr
Public Declare PtrSafe Function SetWindowLongPtr Lib «USER32» Alias «SetWindowLongPtrA» (ByVal hwnd As LongPtr, ByVal nIndex As Long, ByVal dwNewLong As LongPtr) As LongPtr
Public Declare PtrSafe Function DrawMenuBar Lib «USER32» (ByVal hwnd As Long) As LongPtr
Public Declare PtrSafe Function RegOpenKeyA Lib «advapire32.dll» (ByVal hKey As LongPtr, ByVal lpSubKey As String, phkResult As LongPtr) As LongPtr
#Else
‘Si es de 32 bits
Public Declare Function ShellExecute Lib «shell32.dll» Alias «ShellExecuteA» (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
Public Declare Function FindWindow Lib «USER32» Alias «FindWindowA» (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Public Declare Function GetWindowLong Lib «USER32» Alias «GetWindowLongA» (ByVal hwnd As Long, ByVal nIndex As Long) As Long
Public Declare Function SetWindowLong Lib «USER32» Alias «SetWindowLongA» (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Public Declare Function DrawMenuBar Lib «USER32» (ByVal hwnd As Long) As Long
Public Declare Function RegOpenKeyA Lib «advapire32.dll» (ByVal hKey As Long, ByVal lpSubKey As String, phkResult As Long) As Long
#End If
Sub muestra1()
UserForm1.Show
End Sub

Si te fue de utilidad puedes INVITARME UN CAFÉ y de esta manera ayudar a seguir manteniendo la página, CLICK para descargar en ejemplo en forma gratuita.

If this post was helpful INVITE ME A COFFEE and so help keep up the page, CLICK to download free example.