Mostrar mensaje al inicio, barra de progreso y mensaje de finalización al ejecutar MACRO
Tengo esta macro en un Módulo:
Option Explicit
Sub Combinar()
Dim shtLista As Worksheet
Dim strGrado As String
Dim strNombres As String
Dim strCedula As String
Dim strCiudad As String
Dim strFecha As String
Dim filaInicial As Long
Dim objPPT As Object
Dim objPres As Object
Dim objSld As Object
Dim objShp As Object
Rem MsgBox "Proceso INICIADOO..."
Set shtLista = Worksheets("Listado")
Set objPPT = CreateObject("Powerpoint.Application")
objPPT.Visible = True
Set objPres = objPPT.presentations.Open(ThisWorkbook.Path & "\Modelo.pptx")
objPres.SaveAs ThisWorkbook.Path & "\Diplomas.pptx"
filaInicial = 2
Do While shtLista.Cells(filaInicial, 1) <> ""
strGrado = shtLista.Cells(filaInicial, 1)
strNombres = shtLista.Cells(filaInicial, 2)
strCedula = shtLista.Cells(filaInicial, 3)
strCiudad = shtLista.Cells(filaInicial, 4)
strFecha = shtLista.Cells(filaInicial, 5)
Set objSld = objPres.slides(1).Duplicate
For Each objShp In objSld.Shapes
If objShp.HasTextFrame Then
If objShp.TextFrame.HasText Then
ObjShp. TextFrame. TextRange. Replace "<Grado>", strGrado
ObjShp. TextFrame. TextRange. Replace "<Nombres>", strNombres
ObjShp. TextFrame. TextRange. Replace "<Cedula>", strCedula
ObjShp. TextFrame. TextRange. Replace "<Ciudad>", strCiudad
ObjShp. TextFrame. TextRange. Replace "<Fecha>", strFecha
End If
End If
Next
filaInicial = filaInicial + 1
Loop
objPres.slides(1).Delete
objPres.Save
objPres.Close
objPPT.Quit
Rem MsgBox "Proceso FINALIZADO..!"
End SubQuiero que aparezca un Msgbox diciendo "PROCESO INICIADO" y seguidamente, se muestre una barra de progreso así:
Private Sub UserForm_Activate()
Dim Conteo As Long
Dim nFilas As Long
Dim nColumnas As Long
Dim f As Long
Dim c As Long
Dim Porcentaje As Double
Cells.Clear
Conteo = 1
nFilas = 5000
nColumnas = 100
For f = 1 To nFilas
For c = 1 To nColumnas
Cells(f, c) = Conteo
Conteo = Conteo + 1
Next c
Porcentaje = Conteo / (nFilas * nColumnas)
Me.Caption = Format(Porcentaje, "0%" & " Ejecutado...")
Me.Label1.Width = Porcentaje * Me.Frame1.Width
DoEvents
Next f
Unload Me
End Sub

Y finalmente, al terminar, que active Microsoft Excel, lo traiga al frente y muestre un MSGBOX diciendo: "PROCESO FINALIZADO"
2 respuestas
Respuesta de Gabriel Pérez
2
Respuesta de Dante Amor
1
