Results 1 to 3 of 3

Opening Files From Spreadsheet using VBA

Threaded View

  1. #1
    Registered User
    Join Date
    08-27-2012
    Location
    Sydney
    MS-Off Ver
    Excel 2007
    Posts
    7

    Opening Files From Spreadsheet using VBA

    Hi there,

    I have a piece of code that I use to open up files (in this case, a pdf file) on my hard drive, however it opens it up and displays the file as an image, rather than as a pdf file via the Adobe program - see code below:

    Sub OpenFile()
    
         Sheets("Sheet1").Select
         Dim FName As String
          
         FName = "C:\" & Range("D14") & ".pdf"
          
         ActiveSheet.OLEObjects.Add(Filename:=FName, _
         Link:=False, _
         DisplayAsIcon:=False).Select
    End Sub
    I would like help on two matters here:
    1. How can I open the file via Adobe (or similar) rather than as an image?
    2. How do I get the program to search using a different directory (rather than C:\ drive), as I plan on sending out the completed Excel file to customers on a CD or thumb drive. Not know what my customer's directory name will be makes this piece of code redundant apart from on my machine where I know I keep the pdf files.

    Hoping that someone can assist me with this enquiry.

    Thanks

    Mark
    Last edited by arlu1201; 08-29-2012 at 03:41 AM.

Thread Information

Users Browsing this Thread

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

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