Tableau copie image dans USF

XC2ONE

XLDnaute Junior
Bonjour à Vous,

Comme dans la procédure de copie Image d'un graphique pour l'obtenir dans un USF, je souhaiterais obtenir un tableau (ex : A1:E25) en visu dans un USF.

Voici une partie du code d'initialisation de mon USF quand j'apporte un graphique que je voudrais adapter au tableau :

Private Sub UserForm_Initialize()


Sheets('BDDY').Activate
' Range('A1').Select 'uniquement pour Excel97
With ActiveSheet
NbGraph = .ChartObjects.Count
GraphActif = 1
.ChartObjects(GraphActif).CopyPicture xlScreen, xlPicture
Set Image1.Picture = PastePicture(xlPicture)
End With
End Sub


Merci et à bientôt....

Message édité par: xc2one, à: 07/03/2005 17:06
 

MichelXld

XLDnaute Barbatruc
bonsoir

je ne suis pas sur d'avoir bien compris , mais tu peux tester la macro ci dessous



Code:
Private Sub UserForm_Initialize()

Application.ScreenUpdating = False
Sheets('BDDY').Range('A1:E25').CopyPicture
Sheets('BDDY').Paste

With Sheets('BDDY').ChartObjects.Add(0, 0, Image1.Width, Image1.Height).Chart
.Paste
.Export ThisWorkbook.Path & '\\fichierTemp.jpg', 'JPG'
End With

With Sheets('BDDY')
.ChartObjects(Sheets('BDDY').ChartObjects.Count).Delete
.Shapes(Sheets('BDDY').Shapes.Count).Delete
End With

Image1.Picture = LoadPicture(ThisWorkbook.Path & '\\fichierTemp.jpg')
Application.ScreenUpdating = True

End Sub

Private Sub UserForm_Terminate()
Kill ThisWorkbook.Path & '\\fichierTemp.jpg'
End Sub



bonne soiree
MichelXld