Home |
Search |
Today's Posts |
#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
Posted to microsoft.public.excel.newusers
|
|||
|
|||
Excel variable for path
That requires coding. Not sure if you know how to do that in Excel or not...
the resulting open would be "Y:\document\"&Range("A2")&"\proof.doc" "Esgrimidor" wrote: 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. '[image: http://img40.imageshack.us/img40/8749/screenshot1251661545.jpg]' (http://img40.imageshack.us/i/screenshot1251661545.jpg/) Any similar solution is also possible for me . Thankxxx -- Esgrimidor |
#3
Posted to microsoft.public.excel.newusers
|
|||
|
|||
Excel variable for path
As Sean said, this takes a little coding to do, but I'll provide the code an
all you have to do is copy it, put it in the proper place and edit it to match your worksheet and path setup. The comments in the code tell where you have to change things. To put this code in the proper place, open your workbook and RIGHT-click on the name tab for the sheet where this is to be used and choose [View Code] from the list that appears. That will open the VB Editor and present an empty code module to you. Copy the code below and paste it into the module, make any changes to the code that you need to and then close the VB Editor. After you've done that, when you change the entry in the variable cell, it will automatically rebuild the hyperlink in the other cell to point to your document. Here's the code: Private Sub Worksheet_Change(ByVal Target As Range) 'change this to the address of the 'cell with %variable% in it 'make sure you have the $ symbols as shown Const variableCell = "$D$9" 'change this to the address of 'the cell with the hyperlink 'to open your document in it Const linkCell = "$F$9" If Target.Address < variableCell Then Exit Sub End If 'change the portions within " marks to 'form the left and right portions of the 'hyperlink when added to the entry in 'the variable cell ActiveSheet.Hyperlinks.Add Anchor:=Range(linkCell), Address:= _ "C:\Users\" & Range(variableCell) & _ "\Documents\My Word Document.doc", TextToDisplay:= _ "Link to Word Document" End Sub "Esgrimidor" wrote: 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. '[image: http://img40.imageshack.us/img40/8749/screenshot1251661545.jpg]' (http://img40.imageshack.us/i/screenshot1251661545.jpg/) Any similar solution is also possible for me . Thankxxx -- Esgrimidor |
#4
|
|||
|
|||
Quote:
In my spanish version the funcion is HIPERENLACE , instead of hyperlink. I think the variable comes in a cell and the function invokes in other. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
variable path | Links and Linking in Excel | |||
Formula too long - new file path is shorter than old file path - Excel 2003 | Excel Worksheet Functions | |||
Vlookup using variable path name for range value | Excel Worksheet Functions | |||
hyperlink navigation path path wrong in Excel 2003 | Excel Discussion (Misc queries) | |||
make a vlookup using a variable path | Excel Worksheet Functions |