PDA

View Full Version : Macro required for ALT+TAB keys



challenger22
05-01-2010, 12:11 AM
Hi all,

I have to fill some numeric digits in Excel sheet. I have 1000 images. Each image is containing 6 digit number. By viewing the image i need to type that 6 digit number in Excel sheet. Usually i will open image with 'Image viewer'. Normally first i open 1st image and then i will press ALT+TAB. Then it goes to Excel Sheet, here i will type 6 digit number. Again I will press ALT+ TAB. then it goes to image Viewer, then i will press 'Right arrow key', then it goes to next image. Again i will press ALT+TAB. So here My requirement is With out using ALT+TAB, After typing the 6 digit number in excel sheet and whenever i press the 'ENTER', the image viewer has to show next image. Is there any macros available for these type of reqirements. Can u any body please help me in this issue.

lynnnow
05-01-2010, 12:40 AM
Do the images have the numbers in them or are the images' file names a 6 digit number? If the file names are 6 digit numbers the solution will be different and much easier than what you are doing. Please elaborate.

challenger22
05-01-2010, 01:24 AM
Tqs lot for reply, I need not to type Image file name. I have to type 6 digit number which is inside the image. Image file name and 6 digit numbers both are diffirent.

mdmackillop
05-01-2010, 04:49 AM
Welcome to VBAX
Here's a small utility to try. This will list all the jpg files in a selected folder and show the images in turn as you select a cell to insert the number.
Regards
MD

lynnnow
05-01-2010, 05:48 AM
Absolutely fabulous mckillop.

I was working on something similar, however, i used a userform and still needs a load of work (given my limited coding capability)

I've attached it here, and may need tweaking (quite some) since i have not taken care of the error handlers.

Also i noticed that the images can actually go beyond the boundaries of the screen and it can be a hassle scrolling around the worksheet to see the number if the image is quite large. My question is, can the images be resized to some extent so that the whole image is viewed on the current screen or with minimal scrolling to be done?

Love what you tried tho.

Lincoln

mdmackillop
05-01-2010, 07:45 AM
Hi Lynn
I've done a few things with phots in Excel including this KB Item (http://www.vbaexpress.com/kb/getarticle.php?kb_id=839)which includes a resizing facility.

mdmackillop
05-01-2010, 10:37 AM
Sizing added

lynnnow
05-03-2010, 02:18 AM
@Mackillop:

I got an "Unable to get the Pictures property of the Worksheet class" error on

ActiveSheet.Pictures(1).ShapeRange.Width = _
Target * (GetSystemMetrics32(0) - Range("E1").Left)

Am I missing some class module?

Lincoln

mdmackillop
05-03-2010, 06:58 AM
The error was because there was no picture to provide the data. I've reposted the file with error handling added.