Image drag-drop & passed as variable

Nikolis

New Member
Joined
Sep 12, 2022
Messages
27
Office Version
  1. 2007
Platform
  1. Windows
I have a list of countries in the worksheet, with different things (capital, flag etc.) associated with it. What I would like to do is create a geography "game" where a Userform appears and 10 flags & 10 countries names are randomly selected from the list of 200+ entrances. They are listed in 2 columns of the Userform and the player must drag the flag besides the (appropriate) country name.

What I have thought is create a new object, e.g. named Country, where the properties would be name & capital (as strings), flag (image), population etc.

Where I would need help is 3 points ;
(1) can a circular image (the flag, in our case) have "Drag & Drop" behavior activated or somehow set ?

(2) the selected image to be dragged-dropped is the Country.Image for the "correct country" (which is one of the 10). So, somehow I need to make the code recognize if the specific image is the one linked to the specific country. What kind of criteria would actually help the code recognize what is what and materialize this step ?

(3) because there are over 200+ countries I would need to describe step #2 (above) with a procedure and pass the image value in it, e.g. sub determine_flag, with 2 variables, one for the image and the other one for the country.
Like ;
sub determine_flag(French_flag, Denmark) would be a wrong answer (like "False"), while
sub determine_flag(French_flag, France) would produce a correct answer (like "True").
How can I implement the image in it, e.g. through the filename ? As a form control ? As image ? How do we describe it ?
I mean when the image is clicked (OnClick), with or without Drag&Drop following, ... what sort of information does this produce for us code-wise ?

Maybe my inexperience makes me miss something even from the planning stage. I'm not necessarily expecting to get the code complete but any directions would help, even as food for thought.

Thank you in advance.
 
adding a Region and Continent properties to the Country,
- adding tags (cross, lines, number of different colors etc.) to each Flag
I started to do this, but then I thought that rather than hardcode these properties in, why not just have a worksheet of the data, so you can update and change it as you need to.

I've adjusted the code so that it doesn't automatically validate the answer, and have made a number of fixes that the code needed. I'm a bit under the weather at the moment haven't had a whole lot of time, but just wanted to give you an update.
 
Upvote 0

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
Which holder may be circular, in the same dimensions with the flags. Different picture for the holder when it's empty that to when it contains a flag (like a button which has "normal state" and "pressed state").
I'm a visual person, so it might be best if you can mock up an image of what you want it to look like? Otherwise we might go around in circles.
 
Upvote 0
Dan, thank you for your feedback & support. I should be back on Thursday, with a visual background/interface.
 
Upvote 0
Well, here it is ; 4 columns (Flags, Holders waiting for a flag to be dragged-dropped, Countries, Tick/X depending if the flag was placed beside the correct country name)
Flags created by Freepik-Flaticon and downloaded from Flaticon.com
Sample.jpg
 
Upvote 0
Hi. So I've just started working back on this again tonight. I will try and post what I have my the end of tonight, so that at least you have some thing to work with in case I get sick and disappear again.
 
Upvote 0
Hi. So I've just started working back on this again tonight. I will try and post what I have my the end of tonight, so that at least you have some thing to work with in case I get sick and disappear again.
Thank you Dan !
 
Upvote 0

Forum statistics

Threads
1,223,214
Messages
6,170,771
Members
452,353
Latest member
strainu

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