+ Reply to Thread
Results 1 to 9 of 9

Putting a Shape (Rectangle) embedded in worksheet to show on a Userform

  1. #1
    Registered User
    Join Date
    12-26-2016
    Location
    London, England
    MS-Off Ver
    365
    Posts
    79

    Putting a Shape (Rectangle) embedded in worksheet to show on a Userform

    Hi - I hope this is a simple query? Bear with me.....

    I have a worksheet that produces scanable barcodes and a Shape which references the Cell with that Barcode.

    I would like to put the Barcode Image (The Shape) into a userform so when the cell value changes and the Userform is activated the image of the barcode in the shape updates. Hope that makes sense. The only code I have is....

    Please Login or Register  to view this content.
    But I have no idea which Control Box from the Toolbox to use, or the VBA to display it in the userform. Hope someone can assist

    Many thanks
    Hans

  2. #2
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229

    Re: Putting a Shape (Rectangle) embedded in worksheet to show on a Userform

    Actually, this is a difficult process.
    Why do you want the barcode in the user form?
    Is the resolution of your screen good enough for the image to be usable as a bar code? If not, which is likely, then would a static barcode logo suit your needs?
    _
    ...How to Cross-post politely...
    ..Wrap code by selecting the code and clicking the # or read this. Thank you.

  3. #3
    Registered User
    Join Date
    12-26-2016
    Location
    London, England
    MS-Off Ver
    365
    Posts
    79

    Re: Putting a Shape (Rectangle) embedded in worksheet to show on a Userform

    Hi - Thanks for your reply.....

    You are right, I do need to scan the barcode from the screen, and I have of course tested our screen resolutions to ensure they can be scanned, which they do. For ease of use in the tool I am developing I want the user to be able to scan scan the barcode directly from the user form on the screen. I'm sure there is a clunky work-a-round but it would be great to get this functionality working. I am restricted with any additional add-ins as I do not have Administrator rights.

    A mock up of what I am looking for is attached here.

    Hope someone can still help?

    Regards
    Hans

    Image8.jpg
    Attached Images Attached Images

  4. #4
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,236

    Re: Putting a Shape (Rectangle) embedded in worksheet to show on a Userform

    Hey there Hans

    Any particular reason why it has to be an image...Why not have a label referencing said cell that has a barcode font which automatically changes depending on item selection...
    Good Luck
    I don't presume to know what I am doing, however, just like you, I too started somewhere...
    One-day, One-problem at a time!!!
    If you feel I have helped, please click on the star to left of post [Add Reputation]
    Also....add a comment if you like!!!!
    And remember...Mark Thread as Solved.
    Excel Forum Rocks!!!

  5. #5
    Registered User
    Join Date
    12-26-2016
    Location
    London, England
    MS-Off Ver
    365
    Posts
    79

    Re: Putting a Shape (Rectangle) embedded in worksheet to show on a Userform

    Hi there - Unfortunately the format of the Cell is an embedded BARCODE FONT into the Workbook (Administrator Rights Issues) so the cell content is Text and then formatted as a Barcode Font.

    This is the result when you reference the cell into the Label in the Userform. It returns the TEXT rather than the Black and White Barcode

    I'm still searching for a solution !

    Any Ideas?

    Regards Hans


    Image1.jpg

  6. #6
    Registered User
    Join Date
    12-26-2016
    Location
    London, England
    MS-Off Ver
    365
    Posts
    79

    Re: Putting a Shape (Rectangle) embedded in worksheet to show on a Userform

    I think I have found a WORK-AROUND

    1. Create another Cell in the Worksheet with the Barcode in it and size that cell Font to 72pt

    2. Run the VBA to Copy that cell and save it as a JPEG Image to the Desktop.

    Code to copy selected cells and save as JPEG

    Please Login or Register  to view this content.
    3. When the UserForm is initialised run the VBA to create a Dynamic Image into the UserForm (Set the code to Size both the imported Image and its position into that code).

    Code to create 'Dynamic Image' (with your saved JPG) into the UserForm and position it appropriately

    Please Login or Register  to view this content.
    The result is shown below

    Image32.jpg

    Thanks
    Hans

  7. #7
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,236

    Re: Putting a Shape (Rectangle) embedded in worksheet to show on a Userform

    embedded BARCODE FONT
    content is Text and then formatted as a Barcode Font.
    Or all you could have done was change the font to the barcode font in the properties box of the label....

  8. #8
    Registered User
    Join Date
    12-26-2016
    Location
    London, England
    MS-Off Ver
    365
    Posts
    79

    Cool Re: Putting a Shape (Rectangle) embedded in worksheet to show on a Userform

    I did not want to make it that easy for myself - Hopefully the code I posted will help someone else !!!!

    I'm learning everyday !!

    Thanks for your help

    Bye for now
    Hans
    Last edited by hans302; 01-21-2018 at 04:48 AM.

  9. #9
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,236

    Re: Putting a Shape (Rectangle) embedded in worksheet to show on a Userform

    As per imageBarcode.gif

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. How to use a Rectangle shape as progress bar
    By Awni in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-17-2016, 05:07 PM
  2. [SOLVED] I want to add a Rectangle Shape which covers whole sheet!
    By HerryMarkowitz in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-27-2015, 09:32 AM
  3. [SOLVED] Rectangle Shape as Control Button
    By oskar44 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-04-2015, 05:36 PM
  4. Define Shape [Rectangle / L Shape] by cell content
    By SonOfOdin in forum Excel General
    Replies: 8
    Last Post: 12-30-2014, 06:17 AM
  5. [SOLVED] Passing a range to a sub from a shape (rectangle) on the worksheet
    By wazimu13 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-27-2013, 01:01 PM
  6. [SOLVED] Show Picture in UserForm contained within Embedded Worksheet.
    By Environment in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 07-26-2013, 04:34 AM
  7. How to show a chart with a shape on a userform using VBA
    By newbi004 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-17-2013, 01:12 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1