PDA

View Full Version : Excel variable for path



Esgrimidor
08-30-2009, 02:48 PM
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.

http://img40.imageshack.us/img40/8749/screenshot1251661545.jpg (http://img40.imageshack.us/i/screenshot1251661545.jpg/)


Any similar solution is also possible for me .

Thankxxx

mdmackillop
08-30-2009, 03:29 PM
Simplest is FollowHyperlink. Something like

Sub Test()
Dim Str As String
Str = "Y:\document\" & Range("A1") & "\proof.doc"
ActiveWorkbook.FollowHyperlink Str
End Sub

Esgrimidor
08-30-2009, 05:08 PM
I try :

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

http://img84.imageshack.us/img84/880/screenshot1251677177.jpg (http://img84.imageshack.us/i/screenshot1251677177.jpg/)

(http://img42.imageshack.us/i/screenshot1251677186.jpg/)

Done with the real document that is :

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

where 125.09 is the variable.

mdmackillop
08-30-2009, 05:29 PM
Do you have a file called Y:\document\125.09\proof.doc?

Esgrimidor
08-30-2009, 05:43 PM
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

http://img180.imageshack.us/img180/9755/screenshot1251679328.jpg (http://img180.imageshack.us/i/screenshot1251679328.jpg/)