+ Reply to Thread
Results 1 to 7 of 7

Embedding a PDF associates file with a particular pdf reader.

  1. #1
    Registered User
    Join Date
    08-19-2020
    Location
    UK
    MS-Off Ver
    365 ProPlus
    Posts
    4

    Embedding a PDF associates file with a particular pdf reader.

    Hello,
    Ive been using the VBA code included below to embed pdf files into Word documents.

    I have recently discovered that when I do this the packager associates the file with the PDF reader application on the system used to embed the file.
    Later, if someone with a different reader tries to open the file, it simply fails to open with no message; so other people can't open the file.

    It is possible to embed the file by clicking Inset>Object and the selecting package and also choosing the display a icon option. When I do this manually, the file is embedded without the association, and can be opened in whatever reader the user has installed.

    How can I do this in VBA? So that I can automate the clicks away?
    Any help very gratefully received!

    Please Login or Register  to view this content.

  2. #2
    Banned User!
    Join Date
    02-06-2020
    Location
    Iowa City, IA, USA
    MS-Off Ver
    2016 - 365 / 2007
    Posts
    2,014

    Re: Embedding a PDF associates file with a particular pdf reader.

    you said: It is possible to embed the file by clicking Inset>Object and the selecting package and also choosing the display a icon option. When I do this manually, the file is embedded without the association, and can be opened in whatever reader the user has installed.

    doesn't word have a macro recorder just like excel?

  3. #3
    Registered User
    Join Date
    08-19-2020
    Location
    UK
    MS-Off Ver
    365 ProPlus
    Posts
    4

    Re: Embedding a PDF associates file with a particular pdf reader.

    It does, but once the dialog to select a file is open, I am then unable to stop the macro recorder at that point.
    And using this I am unable to set the PDF filter, or ensure that the folder the dialog opens is always at the same location when it launches.

  4. #4
    Banned User!
    Join Date
    02-06-2020
    Location
    Iowa City, IA, USA
    MS-Off Ver
    2016 - 365 / 2007
    Posts
    2,014

    Re: Embedding a PDF associates file with a particular pdf reader.

    I believe there is a bug in this language whereby the file dialog that opens to select files randomly picks dirs that are shown. sometimes it shows the last dir navigated in by a user. sometimes it shows the correct one specified. if you want to set the location on the window to select files from, the following property is supposed to do that:
    Please Login or Register  to view this content.
    per here: https://docs.microsoft.com/en-us/off...nitialfilename

    however, I've noticed it doesn't work very often. see images below. also: https://www.google.com/search?q=init...ba+not+working
    Attached Images Attached Images

  5. #5
    Registered User
    Join Date
    08-19-2020
    Location
    UK
    MS-Off Ver
    365 ProPlus
    Posts
    4

    Re: Embedding a PDF associates file with a particular pdf reader.

    Yes. I have successfully used this in a standard file picker. As you can see in my initial code sample. And for whatever reason it has worked in my scenario.
    The issue is that the only way I have successfully been able to add the file without the association to a particular application is with the manual process, and in this scenario I am unable to set the folder, and file type filter.

    I have tried recording a macro for the whole process and seeing if I can edit the code after, but it seems that once you leave the initial scope, i.e. when the file picker dialog opens, it fails to pick up actions.
    The recorded macro just contains:
    Please Login or Register  to view this content.
    I tried modifying the original code to be:
    Please Login or Register  to view this content.
    But this still forms the association with the PDF reader I have installed.

  6. #6
    Banned User!
    Join Date
    02-06-2020
    Location
    Iowa City, IA, USA
    MS-Off Ver
    2016 - 365 / 2007
    Posts
    2,014

    Re: Embedding a PDF associates file with a particular pdf reader.

    rb,

    I think we were on different pages here throughout this entire conversation. I just reread this from you: I have recently discovered that when I do this the packager associates the file with the PDF reader application on the system used to embed the file.
    Later, if someone with a different reader tries to open the file, it simply fails to open with no message; so other people can't open the file.


    I'm really sorry i can't help you anymore with this. Honestly, I don't see anything wrong with what you did. It just simply could be the fact that office programs aren't the best developed programs in the world to cover all possibilities. good luck with it. and once again, sorry to have to let you go. =(

  7. #7
    Registered User
    Join Date
    08-19-2020
    Location
    UK
    MS-Off Ver
    365 ProPlus
    Posts
    4

    Re: Embedding a PDF associates file with a particular pdf reader.

    Well, thanks for your time anyway!

+ 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. Unable to get Icon file when embedding a file in Excel
    By wilster98 in forum Excel General
    Replies: 1
    Last Post: 12-25-2017, 08:26 PM
  2. [SOLVED] Open a PDF file through Acrobat Reader DC
    By sriley5 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-28-2017, 10:17 PM
  3. Replies: 1
    Last Post: 01-19-2016, 01:11 AM
  4. Closing active Adobe Reader file that was created as a shell
    By scju72 in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 12-11-2014, 05:09 PM
  5. Use VBA to let a PDF reader to save file in directory
    By pahb22 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-15-2012, 06:00 PM
  6. Replies: 0
    Last Post: 05-25-2006, 12:50 AM
  7. [SOLVED] Print Acrobat Reader PDF file from VBA
    By Matthias Claes in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-28-2005, 05:05 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