Buenas tardes! Como están? Les comento, tengo una planilla que utilizo para emitir recibos de pago de las propiedades de las que administro el alquiler en mi inmobiliaria. Actualmente la planilla funciona bien, pero cuando tengo que imprimir los recibos, tengo que ir haciéndolos de a uno y me resultaría más practico escribir una lista de las propiedades de las que ya estoy en condiciones de realizar los recibos y que la macro se vaya repitiendo hasta que haya emitido todos los recibos (ya que la macro es bastante lenta y tengo que esperar unos 10 segundos entre recibo y recibo y son como 120 los que tengo que hacer) Actualmente el recibo se completa cambiando el valor de una celda (que es el que identifica a cada inmueble), por lo que entiendo que lo unico que tendría que hacer el loop, es imprimir el primer recibo, copiar de una lista el número de identificacion de la siguiente propiedad de la lista, copiarlo en la celda que completa el recibo, volver a ejecutar la macro para generar el siguiente recibo y así sucesivamente hasta finalizar toda la lista. Eventualmente estaría bueno que aparezca un aviso cuando ya haya finalizado de emitir todos los recibos. Adjunto el archivo en donde dejé indicado donde pondría la lista de codigos de propiedad a emitir, el boton que ejecuta las macros y cual es la celda que la macro iría modificando para completar los recibos con los datos de cada uno de los inmuebles a imprimir La hojas se desbloquean con la clave 4324 o con el boton rojo que hay en las mismas (cada vez que se ejecuta la macro se vuelve a bloquear) Desde ya les agradezco la ayuda! Anexo: La macro individual actual es la siguiente (en la planilla se ejecuta con un boton amarillo que está en la hoja consultas). Sub Imagen13_Haga_clic_en() Dim Izq As Single, Arr As Single, Ancho As Single, Alto As Single Application.DisplayAlerts = False Application.ScreenUpdating = False ActiveSheet.Unprotect "4324" With Range("H7:R34") Izq = .Left: Arr = .Top: Ancho = .Width: Alto = .Height: .CopyPicture End With With ActiveSheet.ChartObjects.Add(Izq, Arr, Ancho, Alto) .Activate .Chart.Paste .Chart.Export "C:\Users\Usuario\Google Drive\LOCACIONES\REC. PROPIETARIOS\" & Format(Range("q20"), "mmmYY") & " - " & Range("Q9") & " - " & Range("P17") & " - " & Range("K19") & ".JPG" .Delete End With 'ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True, _ (desactivé esto para que no imprima en papel) 'IgnorePrintAreas:=False Range("AH6").Select Selection.Copy Range("AH9").Select Selection.PasteSpecial Paste:=xlPasteValuesAndNumberFormats, Operation:= _ xlNone, SkipBlanks:=False, Transpose:=False Range("Y7:AI33").Select Selection.Copy Range("H7").Select ActiveSheet.Paste Range("a4").Select ActiveSheet.Protect "4324" ActiveWorkbook.Save Dim Email As CDO.Message Set Email = New CDO.Message correo_origen = "nqn.negocios@gmail.com" Clave_correo_origen = "wkfhaapcnjljbwju" correo_destino = Range("ak27").Value Asunto = Range("ak28") Mensaje = Range("ak29") 'correo_copia = "envioacorreocopia@gmail.com" 'correo_copia_oculta = "enviocopiaoculta@gmail.com" Email.Configuration.Fields(cdoSMTPServer) = "smtp.gmail.com" Email.Configuration.Fields(cdoSendUsingMethod) = 2 With Email.Configuration.Fields .Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = CLng(465) .Item("http://schemas.microsoft.com/cdo/" & "configuration/smtpauthenticate") = Abs(1) .Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 30 .Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = correo_origen .Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = Clave_correo_origen .Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = True End With With Email .To = correo_destino .From = correo_origen .Subject = Asunto .TextBody = Mensaje .Configuration.Fields.Update If (Trim(correo_copia) = "") Then .CC = correo_copia End If .AddAttachment (Range("ak30").Value) On Error Resume Next .Send End With End Sub Sub powerbuttonINQ() Dim Izq As Single, Arr As Single, Ancho As Single, Alto As Single Application.DisplayAlerts = False Application.ScreenUpdating = False ActiveSheet.Unprotect "4324" With Range("H7:R33") Izq = .Left: Arr = .Top: Ancho = .Width: Alto = .Height: .CopyPicture End With With ActiveSheet.ChartObjects.Add(Izq, Arr, Ancho, Alto) .Activate .Chart.Paste .Chart.Export "C:\Users\Usuario\Google Drive\LOCACIONES\REC. INQUILINOS\" & Format(Range("q20"), "mmmYY") & " - " & Range("Q9") & " - " & Range("P17") & " - " & Range("J17") & ".JPG" .Delete End With 'ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True, _ 'IgnorePrintAreas:=False Range("AH6").Select Selection.Copy Range("AH9").Select Selection.PasteSpecial Paste:=xlPasteValuesAndNumberFormats, Operation:= _ xlNone, SkipBlanks:=False, Transpose:=False Range("Y7:AI33").Select Selection.Copy Range("H7").Select ActiveSheet.Paste Range("a4").Select ActiveSheet.Protect "4324" ActiveWorkbook.Save Dim Email As CDO.Message Set Email = New CDO.Message correo_origen = "nqn.negocios@gmail.com" Clave_correo_origen = "wkfhaapcnjljbwju" correo_destino = Range("ak27").Value Asunto = Range("ak28") Mensaje = Range("ak29") 'correo_copia = "envioacorreocopia@gmail.com" 'correo_copia_oculta = "enviocopiaoculta@gmail.com" Email.Configuration.Fields(cdoSMTPServer) = "smtp.gmail.com" Email.Configuration.Fields(cdoSendUsingMethod) = 2 With Email.Configuration.Fields .Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = CLng(465) .Item("http://schemas.microsoft.com/cdo/" & "configuration/smtpauthenticate") = Abs(1) .Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 30 .Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = correo_origen .Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = Clave_correo_origen .Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = True End With With Email .To = correo_destino .From = correo_origen .Subject = Asunto .TextBody = Mensaje .Configuration.Fields.Update If (Trim(correo_copia) = "") Then .CC = correo_copia End If .AddAttachment (Range("ak30").Value) On Error Resume Next .Send End With End Sub ALQUILERES L - para POL.xlsm
Por
Corvette , · publicado hace 7 horas 7 hr
Hi Everyone my new problem is this:
On an excel sheet with Office 2007 I entered numbers ranging from cell (A1: E18)
And Three Shape Buttons
Now the purpose of this project and that I would like to be able to achieve is this:
1) Pressing the first key It should from Routine Create a Word Sheet and insert it in my sub Folder called (Attachments) with only the data taken from the cells (A1: E18) and save it with the name I insert in the cell (I1)
2) The Same Thing You Should Be Achieving with an Excel Sheet
3) Also for what concerns the file in pdf format which in some ways is the only one that I was able to make work Except for the fact that I would like it to take into consideration only the numbered cells and not the whole sheet.
I wish you could also insert the image both in the saved Excel sheet and in the Word and PDF sheet
A bit like I did it manually in the various formats that you find in the subfolder called (Attachments) all here
Thank you for all the help you will want to give me on this
Greetings from A.Maurizio
Salvare_File_In_Più_Formati.rar