+ Reply to Thread
Results 1 to 16 of 16

error in attaching pdf file

  1. #1
    Forum Contributor
    Join Date
    07-08-2010
    Location
    ireland
    MS-Off Ver
    Excel 2007
    Posts
    121

    error in attaching pdf file

    Hi all,

    Wondering if anyone can help me.

    I am trying to add pdf file in cell i2 based on serach criteria in cell h2. if serach matches critera, attach file, else return message in i2 that file is not present.

    Please Login or Register  to view this content.
    Thank you

  2. #2
    Valued Forum Contributor natefarm's Avatar
    Join Date
    04-22-2010
    Location
    Wichita, Kansas
    MS-Off Ver
    2016
    Posts
    1,020

    Re: error in attaching pdf file

    Please Login or Register  to view this content.
    Acts 4:12
    Salvation is found in no one else, for there is no other name under heaven given to mankind by which we must be saved.

  3. #3
    Forum Contributor
    Join Date
    07-08-2010
    Location
    ireland
    MS-Off Ver
    Excel 2007
    Posts
    121

    Re: error in attaching pdf file

    Hello Natefarm,

    Thanks for your reply.

    i am getting error when i try to run the code. please see the screen shot.

    Please Login or Register  to view this content.
    [/ATTACH]
    Attached Images Attached Images

  4. #4
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: error in attaching pdf file

    You can't 'add' a PDF file to cell.

    If you want to import the PDF file to the active sheet use this.

    Please Login or Register  to view this content.
    If posting code please use code tags, see here.

  5. #5
    Forum Contributor
    Join Date
    07-08-2010
    Location
    ireland
    MS-Off Ver
    Excel 2007
    Posts
    121

    Re: error in attaching pdf file

    Thanks Norie for the reply

    I used your code but getting run time error.

    please see attachment for the error

    Untitled222.png

  6. #6
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: error in attaching pdf file

    Have you checked the path and filename?

    Does it work if you replace Strfilename with the hard-coded path and filename?

  7. #7
    Forum Contributor
    Join Date
    07-08-2010
    Location
    ireland
    MS-Off Ver
    Excel 2007
    Posts
    121

    Re: error in attaching pdf file

    Hi Norie,

    its working with hardcoded path but when replaced with strfilename, its giving error.
    Please Login or Register  to view this content.

    Regards

  8. #8
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: error in attaching pdf file

    Have you checked the value of fName when you get the error?

  9. #9
    Forum Contributor
    Join Date
    07-08-2010
    Location
    ireland
    MS-Off Ver
    Excel 2007
    Posts
    121

    Re: error in attaching pdf file

    hi Norie,

    Thanks for your help. i just remove set obj before the statement and its working now.

    Regards.

  10. #10
    Forum Contributor
    Join Date
    07-08-2010
    Location
    ireland
    MS-Off Ver
    Excel 2007
    Posts
    121

    Re: error in attaching pdf file

    Last question, can we file to be attached in a particular cell say "i2".

  11. #11
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: error in attaching pdf file

    You can't really attach a file to a cell but the code I posted places the file over I2.

  12. #12
    Forum Contributor
    Join Date
    07-08-2010
    Location
    ireland
    MS-Off Ver
    Excel 2007
    Posts
    121

    Re: error in attaching pdf file

    Hi Norie,

    I cannot able to post over I2. seem like
    Please Login or Register  to view this content.
    not doing anything.

  13. #13
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: error in attaching pdf file

    What was the error when you used Set obj?

    How exactly did you try the code I posted?

  14. #14
    Forum Contributor
    Join Date
    07-08-2010
    Location
    ireland
    MS-Off Ver
    Excel 2007
    Posts
    121

    Re: error in attaching pdf file

    Hi Norie, i used the following code. The error i am getting is attached below.

    Please Login or Register  to view this content.
    Untitled.jpg

  15. #15
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: error in attaching pdf file

    Which sheet is active when you get that error?

    Is it that sheet where B2 contains the name of the PDF file you want to embed?

    Also, where is the code located and how are you running it?

  16. #16
    Forum Contributor
    Join Date
    07-08-2010
    Location
    ireland
    MS-Off Ver
    Excel 2007
    Posts
    121

    Re: error in attaching pdf file

    Hi Norie,

    I have sorted out myself. Thanks for pointing me out to the right direction. The correct code is as follows,

    Please Login or Register  to view this content.
    Regards

+ 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] Outlook Attachment - PDF file not attaching.
    By Maroota in forum Outlook Formatting & Functions
    Replies: 16
    Last Post: 05-01-2015, 06:57 AM
  2. Attaching a document image to an excel file
    By barry1976 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 06-12-2013, 07:59 AM
  3. Attaching a file to an e-mail created from a VBA macro
    By hcarpenter in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-17-2013, 06:51 PM
  4. Error in attaching an excel file
    By Navin Agrawal in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-28-2012, 11:21 AM
  5. Attaching One Worksheet of a File to Email
    By MLCall in forum Excel General
    Replies: 0
    Last Post: 01-17-2012, 12:51 PM
  6. File attaching propblem?
    By raveepoojari in forum Outlook Formatting & Functions
    Replies: 2
    Last Post: 06-20-2009, 06:47 PM
  7. Attaching docs to excel file
    By jeff.nglc in forum Excel General
    Replies: 3
    Last Post: 09-16-2008, 04:02 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