Codice VBA che fornisce diverse uscite quando copia e incolla un'image in un grafico

Ho un problema con il codice per copiare un'image di un intervallo in un object grafico. Il codice funziona perfettamente quando viene eseguito da ThisWorkbook . Tuttavia, quando tento di eseguire il codice tramite una forma di userform , copia solo un'image vuota. È lo stesso codice esatto.

Di seguito è riportto il codice:

 Dim rng As Range Dim imgName As String Set rng = Worksheets("Summary Stats").Range("A1:U11") imgName = "C:\Users\************\Desktop\Temp Files\SummaryPicture.gif" rng.CopyPicture Appearance:=xlScreen, Format:=xlBitmap With Worksheets("Summary Stats").ChartObjects.Add(Left:=rng.Left, Top:=rng.Top, _ Width:=rng.Width, Height:=rng.Height) .Name = "ChartVolumeMetricsDevEXPORT" .Activate End With ActiveChart.Paste Worksheets("Summary Stats").ChartObjects("ChartVolumeMetricsDevEXPORT").Chart.Export imgName Worksheets("Summary Stats").ChartObjects("ChartVolumeMetricsDevEXPORT").Delete Dim rng Come Range Dim rng As Range Dim imgName As String Set rng = Worksheets("Summary Stats").Range("A1:U11") imgName = "C:\Users\************\Desktop\Temp Files\SummaryPicture.gif" rng.CopyPicture Appearance:=xlScreen, Format:=xlBitmap With Worksheets("Summary Stats").ChartObjects.Add(Left:=rng.Left, Top:=rng.Top, _ Width:=rng.Width, Height:=rng.Height) .Name = "ChartVolumeMetricsDevEXPORT" .Activate End With ActiveChart.Paste Worksheets("Summary Stats").ChartObjects("ChartVolumeMetricsDevEXPORT").Chart.Export imgName Worksheets("Summary Stats").ChartObjects("ChartVolumeMetricsDevEXPORT").Delete Fine con Dim rng As Range Dim imgName As String Set rng = Worksheets("Summary Stats").Range("A1:U11") imgName = "C:\Users\************\Desktop\Temp Files\SummaryPicture.gif" rng.CopyPicture Appearance:=xlScreen, Format:=xlBitmap With Worksheets("Summary Stats").ChartObjects.Add(Left:=rng.Left, Top:=rng.Top, _ Width:=rng.Width, Height:=rng.Height) .Name = "ChartVolumeMetricsDevEXPORT" .Activate End With ActiveChart.Paste Worksheets("Summary Stats").ChartObjects("ChartVolumeMetricsDevEXPORT").Chart.Export imgName Worksheets("Summary Stats").ChartObjects("ChartVolumeMetricsDevEXPORT").Delete