Counting Unique Images pasted into a worksheet

SignalServ

New Member
Joined
Sep 21, 2022
Messages
2
Office Version
  1. 365
Platform
  1. Windows
Hi! I am not sure if what I want to do is even possible, but this looks like the place to ask.
I have recently started a business in the security alarm world, and am trying to keep costs down on
smaller projects which require me to provide a floorplan that show device (cameras, card readers, etc).
While there is commercial software available for this, it is very costly, as is using an engineer. Doing it this
way keeps me competitive while I build some revenues.

In the past, I have (for quick, smaller projects) pasted a png or jpg of the floorplan into excel, and simply
copied and pasted the blueprint symbols for each device type over top, in the appropriate location.
Because of the fact that even some smaller projects can have 30-50 devices, I am hoping it is possible to
use VBA to count the total # of each type of device (I am thinking along the lines of counting the recurring
of each file name that was pasted (or a property of it), and listing it in a new sheet).

Can anyone advise if these is possible in any way? it doesn't have to be exactly as I described, as long as the
end result gives me the list of each varying type of device.
 

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.
Hi.

Since no one seemed to take a crack at this, I will just give you an idea. If you like it, perhaps you can start a new topic for each of the following steps.

I was thinking that, if you use the same image(s) to represent different devices, you can tag the images by coloring the top-left pixel of the image (in Ms-paint, for example) with a specific RGB color of your choice. (This is something that you have to do manually . . . just once . . . for every image. And even if you have more than one image that represents (variations) of the same device, that doesn't matter.) That would be a way to determine which images represent which devices.

So after you manually tag each device's image "blueprint",
  1. Get code that exports all images in a sheet to a folder.
  2. Use a modification of this code Handler for image object in GetPixel() API - function? to get the pixel color just of the top-left corner for each picture that was exported.
  3. Create a script that generates a table of information and puts it in a spreadsheet. The table would include the top-left cell where each image is on top of, and what device that image represents.
So how the "software system" would work is, after you have manually made a table with RGB color codes versus devices, you freely create your sheets with the modified images (that all of their top-left pixel is a specific RGB color shade that you have assigned to them . . . so that means you will have to remake all of the floor plans you have with the modified images). Then the first part of the code would export all images in your floor plan sheet to a folder (it would export a copy of the images in the floor plan sheet . . . your floor plan sheet should be "untouched"), where it would the temporary images (in the temporary folder) a name them based on the sheetname that they are in, and the top-left cell that they are on top of in that sheet. The second part of the code would then loop through all images in the folder and get the RGB color shade of their top-left pixel and then append to a table that information (along with the top-left cell that each is on top of . . . of which it got from the name of the image from the folder).

That should do the trick.

But if you don't have the images snapped to grid on the sheet, it may be difficult to determine the top-left cell that each image is on top of in the floor plan sheet. So a possible 4th piece of code to get is simply to first snap all images to the grid (before they are exported to a folder).

I hope that helps.
 
Upvote 0

Forum statistics

Threads
1,214,652
Messages
6,120,746
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