• 0
Sign in to follow this  
vivian.fla

Excel VBA - Inserir Quebra de Página a cada imagem criada por Macro

Question

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:

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

Obrigada!

Share this post


Link to post
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this