Précédent   Forum des professionnels en informatique > Logiciels > Microsoft Office > Excel
Excel Forum d'entraide sur Excel. Vos questions sur les fonctions, formules, manipulations, et tout sujet qui ne trouve pas sa place dans un sous-forum.
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 20/10/2011, 09h07   #1
Invité de passage
 
Homme
Inscription : octobre 2011
Messages : 1
Détails du profil
Informations personnelles :
Sexe : Homme

Informations forums :
Inscription : octobre 2011
Messages : 1
Points : 0
Points : 0
Par défaut transformer un tableau en image

bonjour,

j'avais mis au point il y a quelques temps sous Excel 2000 une macro qui convertissait un tableau, sélectionné avec la souris, en image.
Je suis passé sous Excel 2007 il y a 1 semaine et la macro ne fonctionne plus

Merci beaucoup pour votre (future) aide

Cdt
jll

Voici la macro :

Code :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
Sub creationImage()
 
  '// Création d'une image bitmap
  ActiveSheet.OLEObjects.Add(ClassType:="Paint.Picture", Link:=False, _
        DisplayAsIcon:=False).Activate
  ActiveSheet.Shapes(1).Name = "test"
  ActiveSheet.Shapes("test").Select
  Selection.ShapeRange.IncrementLeft 400
  Selection.ShapeRange.IncrementTop 400
 
  '// Copie du tableau dans l'image
  ActiveSheet.Activate
  Range("O2:S27").Select
  Selection.Copy
 
  ActiveSheet.Shapes("test").Select
  ActiveSheet.Paste
  Selection.ShapeRange.IncrementLeft 39#
  Selection.ShapeRange.IncrementTop 169.5
  ActiveSheet.Shapes(2).Name = "image"
  ActiveSheet.Shapes("image").Select
  ActiveSheet.Shapes("test").Delete
 
  '// Redimensionnement de l'image
  b = Selection.ShapeRange.Width
  Selection.ShapeRange.LockAspectRatio = msoTrue
  Selection.ShapeRange.Width = Selection.ShapeRange.Width * 600 / b
 
  '// Suppression du Copier/coller pour créer un graphe vide
  Application.CutCopyMode = False
 
  '// Création d'un graphique
  Set Co = ActiveSheet.ChartObjects.Add(0, 0, ActiveSheet.Shapes("image").Width, ActiveSheet.Shapes("image").Height)
 
  '// Copie de l'image dans le graphique et sauvegarde
  ActiveSheet.Shapes("image").Copy
  With Co.Chart
    .Paste
    .Export Filename:=ActiveWorkbook.Path & "\testImage.jpg"
  End With
    Co.Delete
  ActiveSheet.Shapes("image").Delete
End Sub
jlr78fr est déconnecté   Envoyer un message privé Réponse avec citation 00
Réponse Proposer ce sujet en actualité
Outils de la discussion



Fuseau horaire GMT +2. Il est actuellement 16h23.


 
 
 
 
Partenaires

Hébergement Web