Consulting

Results 1 to 5 of 5

Thread: Excel variable for path

  1. #1

    Excel variable for path

    Excel variable for path

    I would like propose a variable in an excel cell and launch a word document from other excel cell

    Y:\document\%variable%\proof.doc ,

    where %variable% can take several values.

    The taken value is proposed in an excel cell and seen.




    Any similar solution is also possible for me .

    Thankxxx

  2. #2
    Administrator
    VP-Knowledge Base
    VBAX Grand Master mdmackillop's Avatar
    Joined
    May 2004
    Location
    Scotland
    Posts
    14,489
    Location
    Simplest is FollowHyperlink. Something like
    [vba]
    Sub Test()
    Dim Str As String
    Str = "Y:\document\" & Range("A1") & "\proof.doc"
    ActiveWorkbook.FollowHyperlink Str
    End Sub

    [/vba]
    MVP (Excel 2008-2010)

    Post a workbook with sample data and layout if you want a quicker solution.


    To help indent your macros try Smart Indent

    Please remember to mark threads 'Solved'

  3. #3
    I try :

    I propose the value in the cell A1 , then execute the macro test().



    [img=http://img42.imageshack.us/img42/6537/screenshot1251677186.jpg]

    Done with the real document that is :

    [IMG]file:///M:/DOCUME%7E1/JOSE/CONFIG%7E1/Temp/moz-screenshot.png[/IMG][IMG]file:///M:/DOCUME%7E1/JOSE/CONFIG%7E1/Temp/moz-screenshot-1.png[/IMG]"Y:\GABINETE\PROYECTOS\125.09\125.09.Proyecto.doc"

    where 125.09 is the variable.

  4. #4
    Administrator
    VP-Knowledge Base VBAX Grand Master mdmackillop's Avatar
    Joined
    May 2004
    Location
    Scotland
    Posts
    14,489
    Location
    Do you have a file called Y:\document\125.09\proof.doc?
    MVP (Excel 2008-2010)

    Post a workbook with sample data and layout if you want a quicker solution.


    To help indent your macros try Smart Indent

    Please remember to mark threads 'Solved'

  5. #5
    Quote Originally Posted by mdmackillop
    Do you have a file called Y:\document\125.09\proof.doc?
    Yes I have
    Just created if you need for something
    I try again the script

    No good result


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •