XL 2016 Ajouter la formule de date "=AUJOURDHUI()" dans une macro copie et sauvegarde d'écran

  • Initiateur de la discussion Initiateur de la discussion berru76
  • Date de début Date de début

Boostez vos compétences Excel avec notre communauté !

Rejoignez Excel Downloads, le rendez-vous des passionnés où l'entraide fait la force. Apprenez, échangez, progressez – et tout ça gratuitement ! 👉 Inscrivez-vous maintenant !

berru76

XLDnaute Occasionnel
Bonjour
Je me sers d'une macro "copie et sauvegarde d'ecran je doit rentrer la date manuellement (dans mon cas en F25)
je voudrais mettre la formule "=AUJOURDHUI()" en F25 mais elle ne fonctionne pas avec
si quelqu'un a une solution
Fichier en exemple ci joint
Merci a vous



Sub CopieEcranSaisie_PNG()
Dim Gr As Object, Rg As Range, R$, N$, C$, PathFich$
R$ = "A1:R99"
N$ = ActiveSheet.Range("F25")
C$ = ActiveWorkbook.Path & "\"
Application.ScreenUpdating = False
PathFich$ = C$ & N$ & ".jpg"
Set Rg = ActiveSheet.Range(R$): Rg.CopyPicture xlScreen, xlPicture: DoEvents
Set Gr = ActiveSheet.ChartObjects.Add(0, 0, Rg.Width, Rg.Height): DoEvents
Gr.Activate: ActiveChart.Paste: DoEvents
Gr.Chart.Export PathFich, "jpg": DoEvents
Gr.Delete: Set Gr = Nothing
Application.ScreenUpdating = True
End Sub
 

Pièces jointes

Solution
Re

Désolé, il y avait une coquillle
Il fallait juste remplacer ainsi
Enrichi (BBcode):
Sub CopieEcranSaisie_PNG()
Dim Gr As Object, Rg As Range, R$, N$, C$, PathFich$
R$ = "A1:R99"
N$=Format(Date,"dd_mm_yyyy")
C$ = ActiveWorkbook.Path & "\"
Application.ScreenUpdating = False
PathFich$ = C$ & N$ & ".jpg"
Set Rg = ActiveSheet.Range(R$): Rg.CopyPicture xlScreen, xlPicture: DoEvents
Set Gr = ActiveSheet.ChartObjects.Add(0, 0, Rg.Width, Rg.Height): DoEvents
Gr.Activate: ActiveChart.Paste: DoEvents
Gr.Chart.Export PathFich, "jpg": DoEvents
Gr.Delete: Set Gr = Nothing
Application.ScreenUpdating = True
M$ = "copie écran sauvegardée:" & vbLf & PathFich$
MsgBox M$

End Sub
Là, cela devrait fonctionner
Bonjour
j ai testé en mettant la cellule en date 21_05_2023 et essayer
N$=Format(Date("dd_mm_yyyy")
mais cela bog
pouvez vous m'expliquer ou le mettre
Merci

Sub CopieEcranSaisie_PNG()
Dim Gr As Object, Rg As Range, R$, N$, C$, PathFich$

R$ = "A1:R99"
N$ = ActiveSheet.Range("F25")
C$ = ActiveWorkbook.Path & "\"
Application.ScreenUpdating = False
PathFich$ = C$ & N$ & ".jpg"
Set Rg = ActiveSheet.Range(R$): Rg.CopyPicture xlScreen, xlPicture: DoEvents
Set Gr = ActiveSheet.ChartObjects.Add(0, 0, Rg.Width, Rg.Height): DoEvents
Gr.Activate: ActiveChart.Paste: DoEvents
Gr.Chart.Export PathFich, "jpg": DoEvents
Gr.Delete: Set Gr = Nothing
Application.ScreenUpdating = True
M$ = "copie écran sauvegardée:" & vbLf & PathFich$
MsgBox M$

End Sub
 

Pièces jointes

Re

Désolé, il y avait une coquillle
Il fallait juste remplacer ainsi
Enrichi (BBcode):
Sub CopieEcranSaisie_PNG()
Dim Gr As Object, Rg As Range, R$, N$, C$, PathFich$
R$ = "A1:R99"
N$=Format(Date,"dd_mm_yyyy")
C$ = ActiveWorkbook.Path & "\"
Application.ScreenUpdating = False
PathFich$ = C$ & N$ & ".jpg"
Set Rg = ActiveSheet.Range(R$): Rg.CopyPicture xlScreen, xlPicture: DoEvents
Set Gr = ActiveSheet.ChartObjects.Add(0, 0, Rg.Width, Rg.Height): DoEvents
Gr.Activate: ActiveChart.Paste: DoEvents
Gr.Chart.Export PathFich, "jpg": DoEvents
Gr.Delete: Set Gr = Nothing
Application.ScreenUpdating = True
M$ = "copie écran sauvegardée:" & vbLf & PathFich$
MsgBox M$

End Sub
Là, cela devrait fonctionner
 
Re

Désolé, il y avait une coquillle
Il fallait juste remplacer ainsi
Enrichi (BBcode):
Sub CopieEcranSaisie_PNG()
Dim Gr As Object, Rg As Range, R$, N$, C$, PathFich$
R$ = "A1:R99"
N$=Format(Date,"dd_mm_yyyy")
C$ = ActiveWorkbook.Path & "\"
Application.ScreenUpdating = False
PathFich$ = C$ & N$ & ".jpg"
Set Rg = ActiveSheet.Range(R$): Rg.CopyPicture xlScreen, xlPicture: DoEvents
Set Gr = ActiveSheet.ChartObjects.Add(0, 0, Rg.Width, Rg.Height): DoEvents
Gr.Activate: ActiveChart.Paste: DoEvents
Gr.Chart.Export PathFich, "jpg": DoEvents
Gr.Delete: Set Gr = Nothing
Application.ScreenUpdating = True
M$ = "copie écran sauvegardée:" & vbLf & PathFich$
MsgBox M$

End Sub
Là, cela devrait fonctionner
Je teste
Merci
 
- Navigue sans publicité
- Accède à Cléa, notre assistante IA experte Excel... et pas que...
- Profite de fonctionnalités exclusives
Ton soutien permet à Excel Downloads de rester 100% gratuit et de continuer à rassembler les passionnés d'Excel.
Je deviens Supporter XLD
Retour