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
| Public Img As Control
Private Sub cbDonnées_Click()
On Error Resume Next
Me.Controls.Remove (Img.Name)
With Me.Spreadsheet1
.Visible = True
Set plage = Workbooks("jackborogar source.xls").Sheets("Feuil1").Range("Plage")
For Each c In plage
.Cells(c.Row - plage.Row + 1, c.Column - plage.Column + 1) = c.Value
Next c
End With
End Sub
Private Sub cbExit_Click()
Unload Me
End Sub
Private Sub cbGraphique_Click()
Me.Spreadsheet1.Visible = False
If Img Is Nothing Then
Set Img = Me.Controls.Add("forms.Image.1")
With Img
.Left = 0
.Width = Me.cbExit.Left
.Height = Me.cbExit.Top
.Top = 0
End With
Else
Img.Visible = True
End If
With Workbooks("jackborogar source.xls").Sheets("Feuil1")
On Error Resume Next
Kill ThisWorkbook.Path & "\" & "tmpgraph.jpg"
On Error GoTo 0
.ChartObjects("Graphique 1").Chart.Export ThisWorkbook.Path & "\" & "tmpgraph.jpg", "JPG"
Img.Picture = LoadPicture(ThisWorkbook.Path & "\" & "tmpgraph.jpg")
End With
End Sub
Private Sub UserForm_Activate()
Me.Spreadsheet1.Visible = False
End Sub |
Partager