+ Reply to Thread
Results 1 to 25 of 25

display/show and print a PDF file selected on a listbox on a UserForm

  1. #1
    Registered User
    Join Date
    10-04-2018
    Location
    Cancun, Mexico
    MS-Off Ver
    2013 & 2016 32b
    Posts
    78

    display/show and print a PDF file selected on a listbox on a UserForm

    i need help i have a Userform1 With a Listbox1

    the listbox1 contains pdf files listed from a folder that are on a networkdrive.

    i need a code to show or display that pdf files from that listbox when selected as a pop up userform2 ,
    also i need a bottom to select printer and print pdf flie

    Captura.JPG

  2. #2
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: display/show and print a PDF file selected on a listbox on a UserForm

    Hola manito, welcome to the forum
    To select the pirnter

    Please Login or Register  to view this content.

    to print the pdf file without opening

    Please Login or Register  to view this content.
    hoipe it helps

    Else Google
    excel vba to print selected pdf file without opening
    Happy coding
    ---
    Hans
    "IT" Always crosses your path!
    May the (vba) code be with you... if it isn't; start debugging!
    If you like my answer, Click the * below to say thank-you

  3. #3
    Registered User
    Join Date
    10-04-2018
    Location
    Cancun, Mexico
    MS-Off Ver
    2013 & 2016 32b
    Posts
    78

    Re: display/show and print a PDF file selected on a listbox on a UserForm

    thanks for you answer me so soon ...

    is there a way to show or display the selected PDF file in the list in a popup or second UserForm ?
    and can i open the selected PDF file ?

  4. #4
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: display/show and print a PDF file selected on a listbox on a UserForm

    if the list of PDF files is a listbox then you can just click it to select that file and then add code to print the selected file.
    If you want to open it that you will need code to open the pdf file.

    Syntax: OpenPDFFile(full path and filename here)

    Please Login or Register  to view this content.

  5. #5
    Valued Forum Contributor dotchiejack's Avatar
    Join Date
    05-21-2015
    Location
    Antwerp,Belgium
    MS-Off Ver
    2016
    Posts
    507

    Re: display/show and print a PDF file selected on a listbox on a UserForm

    is there a way to show or display the selected PDF file in the list in a popup or second UserForm ?
    You can use a webbrowser element in a userform.
    See example (unzip first)
    Attached Files Attached Files
    Click the * Add Reputation below to say thanks.

  6. #6
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: display/show and print a PDF file selected on a listbox on a UserForm

    @dotchiejack: thanks for sharing, nice one

  7. #7
    Valued Forum Contributor dotchiejack's Avatar
    Join Date
    05-21-2015
    Location
    Antwerp,Belgium
    MS-Off Ver
    2016
    Posts
    507

    Re: display/show and print a PDF file selected on a listbox on a UserForm

    @ Keebellak: Welcome

  8. #8
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: display/show and print a PDF file selected on a listbox on a UserForm

    @dotchiejack: I couldn't leave it alone
    I made some minor modifications to the form and added 2 controls
    Attached Files Attached Files

  9. #9
    Valued Forum Contributor dotchiejack's Avatar
    Join Date
    05-21-2015
    Location
    Antwerp,Belgium
    MS-Off Ver
    2016
    Posts
    507

    Re: display/show and print a PDF file selected on a listbox on a UserForm

    @ Keebellah, nice job

  10. #10
    Registered User
    Join Date
    10-04-2018
    Location
    Cancun, Mexico
    MS-Off Ver
    2013 & 2016 32b
    Posts
    78

    Re: display/show and print a PDF file selected on a listbox on a UserForm

    this is nice and very helpful , i appreciate both of you , you are great ...

    sorry for the late replay at my work it gets busy sometimes and this project is my puzzle...

    is there also a way to filter those files with a text box and let just those files appear in the list box ? sorry to bother so much with this
    i appreciate all your help you give to me...

  11. #11
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: display/show and print a PDF file selected on a listbox on a UserForm

    Can you explain what you mean by
    is there also a way to filter those files with a text box and let just those files appear in the list box
    Do you mean just show a list of files that answer to a particular description?
    What description/filter?
    What would you like to filter.
    Give facts, not just let's assume ....

  12. #12
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: display/show and print a PDF file selected on a listbox on a UserForm

    In the Userform where you have the Listbox you can add a textbox where you enter part of the filename you want to filter the list on.
    Use this in the code that fills your listbox to see if the filename matches part of the text and if so, you show it.

    Use the InsStr() VBA function and remember it's case sensitive
    The function returns 0 if no match is found

    something like:

    Please Login or Register  to view this content.

  13. #13
    Registered User
    Join Date
    10-04-2018
    Location
    Cancun, Mexico
    MS-Off Ver
    2013 & 2016 32b
    Posts
    78

    Re: display/show and print a PDF file selected on a listbox on a UserForm

    i mean yes ...as in the Private Sub TextBox1_Change() kind ..entering part of the name of the file name and just let appear the pdf files in listbox ? deleting text from text box would let appear all of the files

  14. #14
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: display/show and print a PDF file selected on a listbox on a UserForm

    Do you know how to write that code?
    If not, attach the file you have now (non-private data please) and I'll help you out.

  15. #15
    Registered User
    Join Date
    10-04-2018
    Location
    Cancun, Mexico
    MS-Off Ver
    2013 & 2016 32b
    Posts
    78

    Re: display/show and print a PDF file selected on a listbox on a UserForm

    REQUIS VENTUS.xlsm

    i hope you could help me ... its for userform2

    thank you

  16. #16
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: display/show and print a PDF file selected on a listbox on a UserForm

    I'll take a look and update asap

  17. #17
    Valued Forum Contributor dotchiejack's Avatar
    Join Date
    05-21-2015
    Location
    Antwerp,Belgium
    MS-Off Ver
    2016
    Posts
    507

    Re: display/show and print a PDF file selected on a listbox on a UserForm

    Something like this?
    Filter as you type in the textbox.
    Attached Files Attached Files

  18. #18
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: display/show and print a PDF file selected on a listbox on a UserForm

    I modified your Userform2 and used part of the pdf viewer from as well.
    Give it a try. I added a textbox and an option button on your Userform2 but if you place the mouse over these two you will understand what you have to do.
    Attached Files Attached Files

  19. #19
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: display/show and print a PDF file selected on a listbox on a UserForm

    Minor corrections (cosmetic) and reduced your UserForm1 code a little.
    TIP: replace the hard-coded file path in this module, it is very bad programming
    Attached Files Attached Files

  20. #20
    Registered User
    Join Date
    10-04-2018
    Location
    Cancun, Mexico
    MS-Off Ver
    2013 & 2016 32b
    Posts
    78

    Re: display/show and print a PDF file selected on a listbox on a UserForm



    i would thank both of you keebellah and dotchiejack you rock are amazing

    they work as a charm ...

    sorry for my coding i am just starting very beginner i dont know yet ...

  21. #21
    Registered User
    Join Date
    10-04-2018
    Location
    Cancun, Mexico
    MS-Off Ver
    2013 & 2016 32b
    Posts
    78

    Re: display/show and print a PDF file selected on a listbox on a UserForm

    I can offer ...if one of you need something to translate to spanish let me know ...

  22. #22
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: display/show and print a PDF file selected on a listbox on a UserForm

    Vba is fun and quite easy realy.
    Glad you’re happy.
    Thanks for the spanish offer

  23. #23
    Registered User
    Join Date
    10-04-2018
    Location
    Cancun, Mexico
    MS-Off Ver
    2013 & 2016 32b
    Posts
    78

    Re: display/show and print a PDF file selected on a listbox on a UserForm

    did you study it at school ?you both are like masters and helped me a lot ... for me its very hard vba coding...
    one last question for now : can you help me to add a delete botton for the files below the search box ?
    i know i am a pain ... id tried and it seems not working at all ...its a kill or delete code ?
    sorry iam so lost

  24. #24
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: display/show and print a PDF file selected on a listbox on a UserForm

    Hi, I was away for two days.
    I added the delete button for you
    Attached Files Attached Files

  25. #25
    Registered User
    Join Date
    10-04-2018
    Location
    Cancun, Mexico
    MS-Off Ver
    2013 & 2016 32b
    Posts
    78

    Re: display/show and print a PDF file selected on a listbox on a UserForm

    why are you so quick i still could not figuered it out ... thank you

+ 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. [SOLVED] Userform Listbox - Display selected item in cell
    By Neuk in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-22-2018, 03:39 PM
  2. [SOLVED] Want to open selected file from listbox (Userform)
    By HaroonSid in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 02-04-2017, 12:34 PM
  3. [SOLVED] Want to open selected file from listbox (Userform)
    By HaroonSid in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-03-2017, 12:47 PM
  4. How do I display information from a selected item in a listbox on a userform
    By interceptor91 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-03-2016, 11:57 PM
  5. [SOLVED] Userform Listbox to display selected column
    By Faridwahidi in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 06-25-2015, 02:33 AM
  6. [SOLVED] excel userform to show emails on selected subject from listbox
    By Megatronixs in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-16-2015, 02:46 PM
  7. Display a UserForm based on Data selected in another UserForm's ListBox
    By RPhilbin83 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 07-26-2011, 11:35 AM

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