Este fórum está sendo desativado

Depois de 9 anos, este fórum será desativado. Mas calma.... estamos migrando para uma comunidade no DISCORD. Junte-se a nós.

ENTRAR PARA DISCORD

Tópicos relacionados a códigos VBA, gravação de macros, etc.
Por ElianaGomes
#58029
Bom dia! Tenho uma macro de impressão , mas gostaria de saber como faço para controlar a quantidade de impressão de um mesmo arquivo. E se na folha impressa gostaria que saísse a seguinte mensagem Exemplo: Impressão001-17/08/2020 16:30 Impressão002-18/08/2020 12:00



Sub Imprimir_seleccion()

Dim strCopias As String
Range("A1:L30").Select
Range("L30").Activate
'preparar a folha para impressão
With ActiveSheet.PageSetup
.PrintArea = ""
.Orientation = xlPortrait 'xlLandscape
.PaperSize = xlPaperA4 'formato A4
.BlackAndWhite = True 'incluir cor na folha(False o True)
.FitToPagesWide = 1 'reduzir o tamanho da folha(largura)
.FitToPagesTall = 1 'reduzir o tamanho da folha(altura)
.CenterHorizontally = True 'centralizar horizontalmente
.CenterVertically = False 'centrar verticalmente

End With

'aqui vc deve receber o numero de cópias

strCopias = InputBox("Informe o número de cópias:", "Impressão de documento", 1)

If IsNumeric(strCopias) = True Then


'Aqui faz um Loop até a qtd de cópias desejadas

For i = 1 To strCopias

If i = 1 Then
Range("K19").Value = "Original"
ElseIf i = 2 Then
Range("K19").Value = "Duplicado" & i - 1
ElseIf i = 3 Then
Range("K19").Value = "Triplicado" & i - 1
ElseIf i = 4 Then
Range("K19").Value = "Quadruplicado" & i - 1
Else
Range("K19").Value = "Cópia n. " & i
End If

'imprime a cópia jah com a descrição na célula
ActiveWindow.Selection.PrintOut copies:=1, collate:=True

Next i

End If
End Sub
long long title how many chars? lets see 123 ok more? yes 60

We have created lots of YouTube videos just so you can achieve [...]

Another post test yes yes yes or no, maybe ni? :-/

The best flat phpBB theme around. Period. Fine craftmanship and [...]

Do you need a super MOD? Well here it is. chew on this

All you need is right here. Content tag, SEO, listing, Pizza and spaghetti [...]

Lasagna on me this time ok? I got plenty of cash

this should be fantastic. but what about links,images, bbcodes etc etc? [...]

Estamos migrando para uma comunidade no Discord