+ Reply to Thread
Results 1 to 8 of 8

URGENT - make drop down box select open file automatically

Hybrid View

Muzza86 URGENT - make drop down box... 05-09-2014, 04:27 AM
ragulduy Re: URGENT - make drop down... 05-09-2014, 04:33 AM
Muzza86 Re: URGENT - make drop down... 05-09-2014, 04:51 AM
Muzza86 Re: URGENT - make drop down... 05-09-2014, 04:56 AM
dbestal Re: URGENT - make drop down... 05-09-2014, 05:03 AM
Muzza86 Re: URGENT - make drop down... 05-09-2014, 05:10 AM
dbestal Re: URGENT - make drop down... 05-09-2014, 01:34 PM
ragulduy Re: URGENT - make drop down... 05-12-2014, 04:10 AM
  1. #1
    Forum Contributor
    Join Date
    04-09-2014
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    250

    Question URGENT - make drop down box select open file automatically

    need this a.s.a.p.

    I have attached an example sheet with something that should be easy for you ...

    to sum up - need a drop down box - that when "flange" is selected - It opens a file automatically - no clicking etc. just when that option in the drop down box is chosen.

    thanks


    ps. what I tried initially was something like this..


    sub openfile()
    
    if range("d3" = "flange") then
    openfile thisworkbook.path "\file.pdf"
    end if
    
    end sub

    but doesn't work, plus means I have to click on something.. etc
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    04-22-2013
    Location
    .
    MS-Off Ver
    .
    Posts
    4,418

    Re: URGENT - make drop down box select open file automatically

    You need something like:
    Private Sub Worksheet_Change(ByVal Target as Range)
    If not intersect(Range("D3"),target) is nothing and Range("D3") = "flange" then
      workbooks.open thisworkbook.path & "\file.pdf"
    end if
    End Sub
    It needs to be put in the worksheet object module, not a standard module.

  3. #3
    Forum Contributor
    Join Date
    04-09-2014
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    250

    Re: URGENT - make drop down box select open file automatically

    thanks ill try that.

    also - the problem I have is.. I want the heading and the drop down box to be on the same cell... but when I select something from the drop down box I don't want the orginal heading to change to what I chose.

    e.g. like a website would have a drop down box

    i.e. drawings not drawings - which changes to flange in the cell
    flange

  4. #4
    Forum Contributor
    Join Date
    04-09-2014
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    250

    Re: URGENT - make drop down box select open file automatically

    unfortunately the code in the module doenst work

    the heading of the cell just gets changed to "flange" when I select it but nothing opens and the file is the correct name and stored in same folder as the sheet

  5. #5
    Registered User
    Join Date
    05-09-2014
    Location
    Manila
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: URGENT - make drop down box select open file automatically

    check your file name "\file.pdf"

  6. #6
    Forum Contributor
    Join Date
    04-09-2014
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    250

    Re: URGENT - make drop down box select open file automatically

    file name is fine.

  7. #7
    Registered User
    Join Date
    05-09-2014
    Location
    Manila
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: URGENT - make drop down box select open file automatically

    Code is working pdf cannot be open in excel, change it e.g file.txt it will work

  8. #8
    Forum Expert
    Join Date
    04-22-2013
    Location
    .
    MS-Off Ver
    .
    Posts
    4,418

    Re: URGENT - make drop down box select open file automatically

    Sorry, I didn't notice it was a .pdf not a workbook. Change:
    workbooks.open thisworkbook.path & "\file.pdf"
    to the below, changing path names as appropriate.
    Shell "C:\Program Files\Adobe\Reader 9.0\Reader\AcroRd32.exe C:\file.pdf", vbNormalFocus
    (you can also use activeworkbook.followhyperlink but it is slower I think.)

+ 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. Replies: 5
    Last Post: 12-10-2013, 01:27 PM
  2. Any Way to make an Excel sheet automatically open any linked file as read only?
    By JonBiegen in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-11-2013, 06:41 PM
  3. urgent:how can i open this file?
    By bahar22 in forum Excel General
    Replies: 3
    Last Post: 02-02-2013, 03:05 AM
  4. How to make my macro recognise a 'File Download' window and select 'Open'
    By darossi in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 12-11-2012, 10:21 AM
  5. help me urgent,how to make single querystring to work for multiple select satatements
    By prabhu_javaly in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-25-2005, 04:19 AM

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