vba to take screenshot of a shape with text boxes linked to cell values

spgexcel

New Member
Joined
Mar 16, 2016
Messages
23
Office Version
  1. 365
Platform
  1. Windows
Hello there,
I am again here to ask for a peculiar query.
I have following table in my excel. Using loop vba I pull the values in row 3.
The cells in row 3 are linked with the text boxes in the shape under tag "Main Tab".
I am looking for a poosibility of a vba code where with each iteration in loop there will be a screenshot of that particular output and be pasted in the excel sheet one below other or besides is also fine.
does not need to be linked image it can also be a hard pasted image like a snip from snipping tool.
I tried recording macro but ddi not work. Other ways also failed for me.
I have pasted examples of images that I am talking about.
Is it possible to do in excel? If yes, guidance would help

Thanks in advance
Sumant

screenshot.JPG
 

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
So here is a code that I worked upon with little success.

VBA Code:
Sub new_def2()

Dim dtime As Double
dtime = Timer

Dim i As Long

With Sheets("Sheet2")


    For i = 1 To .Range("B1").Value
    .Range("B3").Value = (i - 1) + 1

Call screenshot

Next i
Application.CutCopyMode = False

Debug.Print "Time is: " & (Timer - dtime)


End With
    
End Sub

VBA Code:
Sub screenshot()

Dim pic_rng As Range
Dim sh_paste As Worksheet
Dim ch_paste As Chart
Dim PicTemp As Picture

Application.ScreenUpdating = False

Set pic_rng = Worksheets("Sheet2").Range("A11:E21")
Set sh_paste = Worksheets("Sheet2")

Charts.Add

ActiveChart.Location Where:=xlLocationAsObject, Name:=sh_paste.Name

Set ch_paste = ActiveChart
pic_rng.CopyPicture Appearance:=xlScreen, Format:=xlPicture

ch_paste.Paste

Application.DisplayAlerts = True

Application.ScreenUpdating = True

'MsgBox ("Range is Saved as Image")

End Sub

I get a badly sized screenshot.


Hello there,
I am again here to ask for a peculiar query.
I have following table in my excel. Using loop vba I pull the values in row 3.
The cells in row 3 are linked with the text boxes in the shape under tag "Main Tab".
I am looking for a poosibility of a vba code where with each iteration in loop there will be a screenshot of that particular output and be pasted in the excel sheet one below other or besides is also fine.
does not need to be linked image it can also be a hard pasted image like a snip from snipping tool.
I tried recording macro but ddi not work. Other ways also failed for me.
I have pasted examples of images that I am talking about.
Is it possible to do in excel? If yes, guidance would help

Thanks in advance
Sumant

View attachment 64907
 
Upvote 0

Forum statistics

Threads
1,214,653
Messages
6,120,750
Members
448,989
Latest member
mariah3

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top