Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Junior Member
 
Posts: 10
Default 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   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 1,696
Default 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   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 2,203
Default 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   Report Post  
Junior Member
 
Posts: 10
Default

Quote:
Originally Posted by JLatham View Post
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
Thank very much.

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
variable path Gerardo Links and Linking in Excel 1 June 12th 09 05:38 AM
Formula too long - new file path is shorter than old file path - Excel 2003 Greg J Excel Worksheet Functions 1 November 22nd 06 05:16 PM
Vlookup using variable path name for range value Jeff Lowenstein Excel Worksheet Functions 1 February 9th 06 01:13 AM
hyperlink navigation path path wrong in Excel 2003 CE Admin Excel Discussion (Misc queries) 5 January 7th 06 07:47 PM
make a vlookup using a variable path Alex St-Pierre Excel Worksheet Functions 1 March 2nd 05 11:54 PM


All times are GMT +1. The time now is 01:10 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"