Précédent   Forum des professionnels en informatique > Logiciels > Microsoft Office > Excel > Macros et VBA Excel
Macros et VBA Excel Vos questions relatives aux macros Excel, à l'utilisation de VBA et à l'automatisation de vos classeurs Excel.
Partagez cette discussion sur d'autres réseaux sociaux : Viadeo Twitter Google Facebook Digg Delicious MySpace Yahoo
Réponse Proposer ce sujet en actualité
 
Outils de la discussion
Publicité
'
Vieux 04/10/2011, 18h06   #1
Invité régulier
 
Homme
Inscription : novembre 2010
Messages : 36
Détails du profil
Informations personnelles :
Sexe : Homme

Informations forums :
Inscription : novembre 2010
Messages : 36
Points : 9
Points : 9
Par défaut Enregistrer cellules dans un fichier pdf

Bonjour,

En fait, j'ai dans ma feuille 2 une plage de cellules(A2: J21) que j'aimerais enregister dans un fichier pdf par un code que j'affecte à un bouton.

Quelqu'un a-t-il une solution....(je pense qu'il y a un copier/coller à faire)

Merci d'avance

AC
igno42 est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 04/10/2011, 18h09   #2
Expert Confirmé
 
Homme Philippe
ex Observeur CGG / Analyste prog.
Inscription : juin 2006
Messages : 1 706
Détails du profil
Informations personnelles :
Nom : Homme Philippe
Localisation : France, Finistère (Bretagne)

Informations professionnelles :
Activité : ex Observeur CGG / Analyste prog.

Informations forums :
Inscription : juin 2006
Messages : 1 706
Points : 3 627
Points : 3 627
Citation:
je pense qu'il y a un copier/coller à faire
Salut, pas exactement si tu as Excel 2007 ou plus voir http://www.developpez.net/forums/d11...-pdf-courriel/ et adapter à ton contexte sinon passer par PdfCreator, pour une recherche sur DVP http://www.google.fr/#sclient=psy-ab...1042&bih=729te
__________________
Pensez à Voter, d'avance merci. ( Pouces en bas à la droite de Citer )
Balisez votre code après l'avoir indenté sous Excel via Smart Indenter
Autre utilitaire : MZ Tools 3.0 VBA

Contribution : Excel / Word / PDF avec Adobe Acrobat Pro / PDFCreator 1 2
kiki29 est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 04/10/2011, 22h00   #3
Invité régulier
 
Homme
Inscription : novembre 2010
Messages : 36
Détails du profil
Informations personnelles :
Sexe : Homme

Informations forums :
Inscription : novembre 2010
Messages : 36
Points : 9
Points : 9
Salut merci pour le lien mais par contre je souhaiterais que cela me demande l'emplacement et non que ça s'enregistre automatiquement dans un endroit...



Voici mon code:

Code :
1
2
3
4
5
6
Sheets("Feuil2").Select
    Range("A1:G20").Select
    ActiveSheet.PageSetup.PrintArea = "$A$1:$G$20"
  ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
        "C:\Users\aurélien\Desktop\gdd.pdf", Quality:=xlQualityStandard, _
        IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:= _
je pense qu'il faut modiufier la partie en rouge

Merci
igno42 est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 04/10/2011, 22h19   #4
Expert Confirmé
 
Homme Philippe
ex Observeur CGG / Analyste prog.
Inscription : juin 2006
Messages : 1 706
Détails du profil
Informations personnelles :
Nom : Homme Philippe
Localisation : France, Finistère (Bretagne)

Informations professionnelles :
Activité : ex Observeur CGG / Analyste prog.

Informations forums :
Inscription : juin 2006
Messages : 1 706
Points : 3 627
Points : 3 627
Re, à adapter : ShTst correspond au CodeName de la feuille à sauvegarder : voir http://www.developpez.net/forums/d92...cel/vba-bases/

Code :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
Option Explicit
 
Sub Tst()
Dim NomFichier As Variant
 
    ChDir ThisWorkbook.Path
    NomFichier = Application.GetSaveAsFilename("Test.pdf", fileFilter:="PDF (*.pdf), *.pdf")
 
    If NomFichier <> False Then
        With ShTst
            .PageSetup.PrintArea = "$A$1:$D$26"
            .ExportAsFixedFormat Type:=xlTypePDF, _
                                 Filename:=NomFichier, _
                                 Quality:=xlQualityStandard, IncludeDocProperties:=True, _
                                 IgnorePrintAreas:=False, OpenAfterPublish:=False
        End With
    End If
End Sub
__________________
Pensez à Voter, d'avance merci. ( Pouces en bas à la droite de Citer )
Balisez votre code après l'avoir indenté sous Excel via Smart Indenter
Autre utilitaire : MZ Tools 3.0 VBA

Contribution : Excel / Word / PDF avec Adobe Acrobat Pro / PDFCreator 1 2
kiki29 est déconnecté   Envoyer un message privé Réponse avec citation 10
Vieux 04/10/2011, 22h44   #5
Invité régulier
 
Homme
Inscription : novembre 2010
Messages : 36
Détails du profil
Informations personnelles :
Sexe : Homme

Informations forums :
Inscription : novembre 2010
Messages : 36
Points : 9
Points : 9
Merci j'ai adapté le code...cela fonctionne
igno42 est déconnecté   Envoyer un message privé Réponse avec citation 00
Réponse Proposer ce sujet en actualité Cette discussion est résolue.
Outils de la discussion



Fuseau horaire GMT +2. Il est actuellement 04h16.


 
 
 
 
Partenaires

Hébergement Web