+ Reply to Thread
Results 1 to 9 of 9

Viewing a PDF File within excel based on a cell value

  1. #1
    Registered User
    Join Date
    01-13-2017
    Location
    Cincinnati Ohio
    MS-Off Ver
    2013
    Posts
    5

    Viewing a PDF File within excel based on a cell value

    Hello,

    This is my first time posting to the website so I'm sorry if I don't provide enough information. I am working in a manufacturing facility and I am trying to build a file for the floor operators to use. I have a stand alone computer with a barcode scanner attached so each time we change to a new product the barcode is scanned prompting the file to pull up all the information for the new part. Currently I have a code that calls a jpeg file up and shows a work instruction on the screen, updating each time a new barcode is scanned. The code that performs this action is shown below. What I want to do is pull up a pdf file instead. We save all of our files as pdf's and currently I have to convert the pdf to a jpeg and save it in a different file folder to keep file working. I want to make it standard so that the file draws from our controlled folder that is updated everytime we create a new file.

    Please Login or Register  to view this content.
    I have tried changing this to state "Image1.Picture = LoadPicture(MyDocs & Sheet1.Range("C2") & ".pdf") however the file does not show display, there are no run errors however there is nothing displayed on the screen. Is there any way to do this so I do not have to convert the file to a .jpg file?
    Last edited by murphyd6; 01-13-2017 at 04:33 PM.

  2. #2
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,956

    Re: Viewing a PDF File within excel based on a cell value

    Let me restate to see if I understand the requirement. You currently have a folder with pictures in it. When you scan a bar code, the result goes into Cell C2. This information is used to find the associated picture and display it in the worksheet.

    Would the following be acceptable? I'm not sure I can display the PDF document as part of the spreadsheet, but I can open and display the document. You will have both the spreadsheet and the PDF file open separately.

    Also: learn to use code tags. The mods will get on your case if you don't. It's simple put the word code in square brackets in front of your code and /code in square brackets after the code. Else you will see the following "nastygram:"
    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code.

    Posting code between [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    Click on Edit to open your thread, then highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here

    (This thread should receive no further responses until this moderation request is fulfilled, as per Forum Rule 7)
    One spreadsheet to rule them all. One spreadsheet to find them. One spreadsheet to bring them all and at corporate, bind them.

    A picture is worth a thousand words, but a sample spreadsheet is more likely to be worked on.

  3. #3
    Forum Contributor Axmed.cm's Avatar
    Join Date
    02-05-2015
    Location
    Somalia
    MS-Off Ver
    2013
    Posts
    231

    Re: Viewing a PDF File within excel based on a cell value

    Please attach a sample of your document for more clarity.
    GUURE

  4. #4
    Forum Contributor Axmed.cm's Avatar
    Join Date
    02-05-2015
    Location
    Somalia
    MS-Off Ver
    2013
    Posts
    231

    Re: Viewing a PDF File within excel based on a cell value

    Please attach a sample of your document for more clarity and understanding.

  5. #5
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,956

    Re: Viewing a PDF File within excel based on a cell value

    This may do what you want to do. Modify the path.
    Attached Files Attached Files

  6. #6
    Registered User
    Join Date
    01-13-2017
    Location
    Cincinnati Ohio
    MS-Off Ver
    2013
    Posts
    5

    Re: Viewing a PDF File within excel based on a cell value

    Thank you for the assistance on how to upload code. Attached is the file.

    The smart shape is where the current jpeg is displayed. Cell C2 is updated each time we change part numbers.
    This prompts the jepg image to change. I protected the file so each time a new barcode is scanned it essentially
    hits enter but stays on the same cell. Prompting the change without having to hit the enter key.
    Attached Files Attached Files

  7. #7
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,956

    Re: Viewing a PDF File within excel based on a cell value

    It turns out that this is a lot easier than I thought it would be. There is a line in the code that you need to change to reflect where your PDF files are stored.

    I put change event on the Setting MC Work Instructions sheet on Cell C2. When you change the value in this cell, it kicks off the program automatically.

    The PDF picture is embedded starting in Cell A6. If you double click it, it launches Adobe Acrobat (or whatever your system PDF view is) as a separate instance and you can view the entire document.

    Note: the document image on the screen may go blank while Adobe is open.
    Attached Files Attached Files

  8. #8
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,956

    Re: Viewing a PDF File within excel based on a cell value

    I thought it would be nice to show you which line to change in the code.

    Please Login or Register  to view this content.

  9. #9
    Registered User
    Join Date
    01-13-2017
    Location
    Cincinnati Ohio
    MS-Off Ver
    2013
    Posts
    5

    Re: Viewing a PDF File within excel based on a cell value

    That worked. Thank you very much.

+ 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. Opening a txt file based on cell value in excel
    By Drstevef in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-09-2015, 04:03 PM
  2. Replies: 2
    Last Post: 01-07-2015, 11:46 AM
  3. Replies: 6
    Last Post: 08-10-2014, 03:50 AM
  4. Viewing affected formulas based on a cell value
    By ezdizzy in forum Excel General
    Replies: 5
    Last Post: 03-21-2011, 02:16 PM
  5. Excel 2007 : Viewing shared file
    By depot in forum Excel General
    Replies: 0
    Last Post: 07-19-2010, 09:57 AM
  6. Viewing data in Excel while scrolling. Instead of the cell count?
    By RUSmiling in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 04-14-2006, 01:10 PM
  7. naming .xls file based on a cell in excel
    By lsu-i-like in forum Excel General
    Replies: 1
    Last Post: 06-24-2005, 04:44 PM

Tags for this Thread

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