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.
#41148
Olá malta,

Estou a criar uma folha e queria introduzir imagens nos cabeçalhos e rodapés mas usando VBA.
Encontrei este código que permite proteger o cabeçalho e rodapé mas queria inserir imagem em vez de texto em alguns deles.

Aqui fica o código. Podem ajudar-me a inserir as imagens também (mas usando esta proteção)?
Já tentei várias hipóteses mas… não consigo...

Option Explicit
Private Sub Workbook_BeforePrint(Cancel As Boolean)
Call ProtectHF
End Sub

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
Call ProtectHF
End Sub

Private Sub Workbook_Open()
Call ProtectHF
End Sub

Private Sub ProtectHF()
'Updateby Extendoffice 20161027
Application.ScreenUpdating = False
Dim strHeaderTextL As String
strHeaderTextL = " Not for copy "
Dim strHeaderTextC As String
strHeaderTextC = " Created by ... "
Dim strHeaderTextR As String
strHeaderTextR = " Not for copy "
Dim strFooterTextL As String
strFooterTextL = " Not for copy "
Dim strFooterTextC As String
strFooterTextC = " Not for copy "
Dim strFooterTextR As String
strFooterTextR = " Not For Copy "
ThisWorkbook.ActiveSheet.PageSetup.RightHeader = "&B&20" & strHeaderTextR & ""
ThisWorkbook.ActiveSheet.PageSetup.RightFooter = "&B&20" & strFooterTextR & ""
ThisWorkbook.ActiveSheet.PageSetup.CenterHeader = "&B&20" & strHeaderTextC & ""
ThisWorkbook.ActiveSheet.PageSetup.CenterFooter = "&B&20" & strFooterTextC & ""
ThisWorkbook.ActiveSheet.PageSetup.LeftHeader = "&B&20" & strHeaderTextL & ""
ThisWorkbook.ActiveSheet.PageSetup.LeftFooter = "&B&20" & strFooterTextL & ""
Application.ScreenUpdating = True
End Sub
#41154
Boa noite Pedro.

Essa imagem que você quer adicionar no cabeçalho e no rodapé, deve aparecer apenas quando você for enviar para impressão? Pode ser for, acredito que não precise do VBA, é possível configurar isso nas propriedades de impressão.

Att.
#41182
Olá GroverL,
A ideia é o utilizador não poder inserir nada no cabeçalho e rodapé. Apenas o programador o pode fazer. É apenas uma medida de proteção do ficheiro. Por isso acho que precisava disso mesmo. ..
#41500
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