I've written a code to copy the charts from a worksheet (in my excel workbook) to Ms-Paint and then saving the results.
I am getting an error at the <code style="margin: 0px; padding: 1px 5px; border: 0px; font-family: Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace, sans-serif; white-space: pre-wrap; color: rgb(36, 39, 41); background-color: rgb(239, 240, 241);">Call AppActivate(paintID)</code> further, I want to ask if by calling <code style="margin: 0px; padding: 1px 5px; border: 0px; font-family: Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace, sans-serif; white-space: pre-wrap; color: rgb(36, 39, 41); background-color: rgb(239, 240, 241);">Call SendKeys("^V")</code> and then <code style="margin: 0px; padding: 1px 5px; border: 0px; font-family: Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace, sans-serif; white-space: pre-wrap; color: rgb(36, 39, 41); background-color: rgb(239, 240, 241);">Call SendKeys("^S")</code> will do the job.
Code:
<code style="margin: 0px; padding: 0px; border: 0px; font-family: Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace, sans-serif; white-space: inherit;">[COLOR=#101094]Sub[/COLOR][COLOR=#303336] paintCharts[/COLOR][COLOR=#303336]()[/COLOR][COLOR=#303336]
ThisWorkbook[/COLOR][COLOR=#303336].[/COLOR][COLOR=#303336]Sheets[/COLOR][COLOR=#303336]([/COLOR][COLOR=#7D2727]"DesiredData"[/COLOR][COLOR=#303336]).[/COLOR][COLOR=#303336]Activate
[/COLOR][COLOR=#101094]With[/COLOR][COLOR=#303336] ActiveSheet[/COLOR][COLOR=#303336].[/COLOR][COLOR=#303336]ChartObjects[/COLOR][COLOR=#303336].[/COLOR][COLOR=#303336]ShapeRange[/COLOR][COLOR=#303336].[/COLOR][COLOR=#303336]Group
[/COLOR][COLOR=#303336].[/COLOR][COLOR=#303336]CopyPicture
[/COLOR][COLOR=#303336].[/COLOR][COLOR=#303336]Ungroup
[/COLOR][COLOR=#101094]End[/COLOR][COLOR=#101094]With[/COLOR][COLOR=#303336]
[/COLOR][COLOR=#101094]Dim[/COLOR][COLOR=#303336] path_Paint [/COLOR][COLOR=#101094]As[/COLOR][COLOR=#101094]String[/COLOR][COLOR=#303336]
[/COLOR][COLOR=#101094]Dim[/COLOR][COLOR=#303336] paintID [/COLOR][COLOR=#101094]As[/COLOR][COLOR=#101094]Variant[/COLOR][COLOR=#303336]
path_Paint [/COLOR][COLOR=#303336]=[/COLOR][COLOR=#7D2727]"C:\Windows\System32\mspaint.exe"[/COLOR][COLOR=#303336]
paintID [/COLOR][COLOR=#303336]=[/COLOR][COLOR=#303336] Shell[/COLOR][COLOR=#303336]([/COLOR][COLOR=#303336]path_Paint[/COLOR][COLOR=#303336],[/COLOR][COLOR=#303336] vbNormalFocus[/COLOR][COLOR=#303336])[/COLOR][COLOR=#303336]
[/COLOR][COLOR=#101094]Call[/COLOR][COLOR=#303336] AppActivate[/COLOR][COLOR=#303336]([/COLOR][COLOR=#303336]paintID[/COLOR][COLOR=#303336])[/COLOR][COLOR=#303336]
[/COLOR][COLOR=#101094]Call[/COLOR][COLOR=#303336] SendKeys[/COLOR][COLOR=#303336]([/COLOR][COLOR=#7D2727]"^V"[/COLOR][COLOR=#303336])[/COLOR][COLOR=#303336]
[/COLOR][COLOR=#101094]End[/COLOR][COLOR=#101094]Sub[/COLOR]</code>
I am getting an error at the <code style="margin: 0px; padding: 1px 5px; border: 0px; font-family: Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace, sans-serif; white-space: pre-wrap; color: rgb(36, 39, 41); background-color: rgb(239, 240, 241);">Call AppActivate(paintID)</code> further, I want to ask if by calling <code style="margin: 0px; padding: 1px 5px; border: 0px; font-family: Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace, sans-serif; white-space: pre-wrap; color: rgb(36, 39, 41); background-color: rgb(239, 240, 241);">Call SendKeys("^V")</code> and then <code style="margin: 0px; padding: 1px 5px; border: 0px; font-family: Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace, sans-serif; white-space: pre-wrap; color: rgb(36, 39, 41); background-color: rgb(239, 240, 241);">Call SendKeys("^S")</code> will do the job.
Last edited: