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.
  • Avatar do usuário
#33698
Boa noite!
Estou com uma planilha criada para impressão de etiquetas que altera a numeração do volume sequencialmente e cria várias imagens em uma nova planilha para impressão. Só que eu precisava inserir uma quebra de página a cada imagem criada para que não desconfigure a impressão na máquina Zebra.
Alguém consegue me ajudar?

O código está assim:
Código: Selecionar todos
Option Explicit
Sub Formatar_Impressão()
Dim vTl As Variant, i As Long, cLocal As Long: cLocal = 1
Dim ws As Worksheet: Set ws = Sheets("IMPRESSAO")
Dim rng As Range
Dim ct As Integer: ct = 0
DeleteAllPictures ' chama rotina que remove todas imgs
i = 1
vTl = InputBox("Por favor, digite o total de volumes!", "Valor Total de Volumes")

For i = i To vTl
Plan1.Range("C7").Value = i
Plan1.Range("E7").Value = vTl
Set rng = Plan1.Range("b1:g8")
With ws
rng.Copy
.Activate
.Range("A" & cLocal).Select
.Pictures.Paste
cLocal = cLocal + 17
ct = ct + 1
Application.CutCopyMode = False
End With
Next
ActiveSheet.PageSetup.PrintArea = ""
With ActiveSheet.PageSetup
.Zoom = 99
.LeftMargin = Application.CentimetersToPoints(0)
.RightMargin = Application.CentimetersToPoints(0)
.TopMargin = Application.CentimetersToPoints(0)
.BottomMargin = Application.CentimetersToPoints(1.5)
.HeaderMargin = Application.CentimetersToPoints(0)
.FooterMargin = Application.CentimetersToPoints(0)
.CenterHorizontally = True
.CenterVertically = True
.Orientation = xlPortrait
End With
If ct > 0 Then
MsgBox " Foram inseridas " & ct & " Etiquetas", 0, "Sucesso"
Else
MsgBox "Nenhuma Etiqueta foi inserida! Verifique!", 64, "Atenção"
End If
End Sub

Private Sub DeleteAllPictures()
Dim ws As Worksheet: Set ws = Sheets("IMPRESSAO")
With ws
.Activate
.Pictures.Delete
End With
End Sub
#33712
Experimente:

na Sub Formatar_Impressão acrescente a linha em vermelho conforme abaixo
ct = ct + 1
ActiveSheet.HPageBreaks.Add Before:=Rows(cLocal - 5) 'acrescente esta linha


na Private Sub DeleteAllPictures acrescente a linha em vermelho conforme abaixo
.Pictures.Delete
.ResetAllPageBreaks 'acrescente esta linha
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