ok, so here goes. what im trying to achieve is to be able to grab the exact replica or photo of everything included in " Front of check" worksheet and view it on a separate form in vba after clicking a button. sort of like a photo preview. however, when i debug it it crashes at
what the heck am i missing? Ive been at this for about 3 hours and have tried other things too.
here is what i have so far...
Code:
Set Picture = LoadPicture("C:\CheckMaster\temp\MyPic.jpg")
here is what i have so far...
Code:
Private Sub CommandButton1_Click()Sheets(" Front of check").Activate
'Prepare to copy
Range("A1:L20").Copy
Sheets("sheet3").Activate
Range("A1").Select
ActiveSheet.Pictures.Paste Link:=True
ActiveSheet.Pictures.Select
Application.CutCopyMode = False
Dim myChart As String, myPicture As String
Dim picWidth As Long, picHeight As Long
Application.ScreenUpdating = False
myPicture = Selection.Name
With Selection
picHeight = .ShapeRange.Height
picWidth = .ShapeRange.Width
End With
Charts.Add
ActiveChart.Location Where:=xlLocationAsObject, Name:="Sheet3"
Selection.Border.LineStyle = 0
myChart = Selection.Name & " " & Split(ActiveChart.Name, " ")(2)
With ActiveSheet
With .Shapes(myChart)
.Width = picWidth
.Height = picHeight
End With
.Shapes(myPicture).Copy
With ActiveChart
.ChartArea.Select
.Paste
End With
.ChartObjects(1).Chart.Export Filename:="C:\CheckMaster\temp\MyPic.jpg", FilterName:="jpg"
.Shapes(myChart).Cut
End With
Application.ScreenUpdating = True
Set Picture = LoadPicture("C:\CheckMaster\temp\MyPic.jpg")
ActiveSheet.Pictures.Delete
End Sub