Forum

Notifications
Clear all

Auto screen shot

16 Posts
3 Users
0 Reactions
481 Views
(@mohith6my)
Posts: 18
Eminent Member
Topic starter
 

Hi,
Required suggestion on this.

Once the command in excel is given , the excel should be minimized and the screen shot of the desktop has to be taken, the image of the screen shot has to be saved in a folder with file name from a cell in the excel and the link of the image should be available in another file.
Is this possible?

 
Posted : 11/01/2020 11:53 pm
(@purfleet)
Posts: 412
Reputable Member
 

Hi Mohith

Please see attched - i actually wasnt as hard as i thought once i got to grips with the objects and shapes. It could be improved and it certainly isnt perfect but might give you a start.

Cells A1 to A4 are where you want the output saved, the file name, date and time (to make the picture name unique) and then the file extension.

I have tested in Excel  365 and 2016

Let me know if it was what you were after

Purfleet

 
Posted : 12/01/2020 10:23 am
(@mohith6my)
Posts: 18
Eminent Member
Topic starter
 

Hello Purfleet,

Thank you very much for the support.

It is working, but i could not prepare the file as i wished for. Request your support again.

Please find the attached file where i have drafted the format which is required. Column A will be the date, Column B will be the file name (input will be given by the user), Column C should be the file location (Documents folder). The command test report is the run key (this is common for all the reports).

Thanks for your kind support in advance.

 

Thanks,

Mohith

 
Posted : 13/01/2020 7:54 am
(@purfleet)
Posts: 412
Reputable Member
 

Hi Mohith

Updated macro using b2 as the file name with A2 also appended and the .jpeg is hardcoded - so the file name will be '1330123456 12012020.jpg'. This does mean that running the macro more than once per day will overwrite the previous screen dump.

I couldn’t workout what the list of dates and work orders were for, so only the top one is used for saving.

I have also noted the code to say what each part is doing, so you could be able to change the variables fairly easy

Purfleet

 
Posted : 13/01/2020 4:49 pm
(@mohith6my)
Posts: 18
Eminent Member
Topic starter
 

Hello Purfleet,

Good Day!

Thanks for the updated macro.

The file will be updated with approximately 50 inputs in column B in a day. All these values will be with unique numbers. The dump should not be overwritten but should be saved with file name from cell B every time the input is given in column B.

Also i changed the location to Documents and i got run time error. The screen shot captured from the macro was of the excel sheet and not the desktop. Once the excel is minimized, there will be another screen of the test  which has to be captured and saved.

Sorry if I am troubling you with lot of confusing inputs from my side :-).

Thanks again for your continued support on this topic.

MohithFail-report.JPGFail-report1.JPG

 
Posted : 14/01/2020 1:05 am
(@purfleet)
Posts: 412
Reputable Member
 

Morning

1 - The file will be updated with approximately 50 inputs in column B in a day. All these values will be with unique numbers. The dump should not be overwritten but should be saved with file name from cell B every time the input is given in column B.

So you want the last cell on column B to be the file name?

2 - Also i changed the location to Documents and i got run time error. The screen shot captured from the macro was of the excel sheet and not the desktop. Once the excel is minimized, there will be another screen of the test  which has to be captured and saved.

You will need to type in the proper file path for the save location - something like "C:ScreenDumpMonday" (it must end with a backslash)

You will also need to minimise all other windows manually as it doesn't seem possible to minimise all windows with VBA

The macro is far from perfect and will need tweaking as a lot of this code is using workarounds for a specific purpose.

 
Posted : 15/01/2020 8:35 am
(@mohith6my)
Posts: 18
Eminent Member
Topic starter
 

Hello Purfleet, Good morning!

So you want the last cell on column B to be the file name?

Yes, the last input in the column B should be the file name.

 
Posted : 16/01/2020 11:19 pm
(@mohith6my)
Posts: 18
Eminent Member
Topic starter
 

You will need to type in the proper file path for the save location - something like "C:ScreenDumpMonday" (it must end with a backslash)

Sorry i didn't show the path for the save location in my last reply. Please find the path which i have given and the error code.Capture.JPG 

 
Posted : 16/01/2020 11:26 pm
(@purfleet)
Posts: 412
Reputable Member
 

That error is not the path, but the dodgy process we are doing for the screen dump.

It works on the Visual Basic editor is open but not if closed! I have no idea why

I have change arround a bit of code and now it seems to work without the VBE open, but now only works every other press!

Will try and test some more over the weekend

 
Posted : 17/01/2020 4:31 pm
(@mohith6my)
Posts: 18
Eminent Member
Topic starter
 

Thank you very much. I got what I had thought. 1234-17012020.jpg

One observation now is that the screenshot is captured immediately and it is capturing during minimizing of excel. Please have a look when you find time for this.

Thank you Purfleet again for your wonderful support.111-17012020.jpg 

 
Posted : 17/01/2020 11:04 pm
(@purfleet)
Posts: 412
Reputable Member
 

Strange seems to work for me (well every other time)

Try it with excel maximised to fill the whole screen

 
Posted : 18/01/2020 11:35 am
(@mohith6my)
Posts: 18
Eminent Member
Topic starter
 

Tried doing the same. No changes.5678-20012020.jpg1234-20012020.jpg

 
Posted : 20/01/2020 11:09 pm
(@purfleet)
Posts: 412
Reputable Member
 

Strange worked for me on my laptop and desktop. Maybe it is because you have multiple Excel sessions open.

Dont forget that what we are doing here is something that Excel is not designed for and everything is a work around

You are best off trying different things to see what works

Purfleet

 
Posted : 21/01/2020 2:32 am
(@mohith6my)
Posts: 18
Eminent Member
Topic starter
 

Hello Purfleet,

Trust you are doing well. 

Thanks for the support on building this excel file. 

Request your kind support on this topic again, recently our system was upgraded to Windows 11 due to which the current excel file is having some error which we could not figure it out. 

Could you please check and support on this.

BR,

MohithError-image.jpg

 
Posted : 18/09/2024 1:24 am
(@mohith6my)
Posts: 18
Eminent Member
Topic starter
 

Hello All,

Can anybody else resolve this?

 
Posted : 20/09/2024 5:33 am
Page 1 / 2
Share: