Thread: relative path
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
JLGWhiz JLGWhiz is offline
external usenet poster
 
Posts: 3,986
Default relative path

You could probably control it with an If statement in the Workbook_Open event.

expl: If ThisWorkbook.Path = C:\MyDocuments\directory #1\ Then
Workbooks(exceldocument.xlsx).Range("A1") = "abc"
ElseIf ThisWorkbook.Path = C:\MyDocuments\directory #2\ Then
Workbooks(exceldocument.xlsx).Range("A1") = "def"
End If

Then in your underlying code in the Excel file, use a variable to reference
Range("A1") to detect the abc or def.


"Jorge mst" wrote:

Hello
Sorry if I don't make myself clear.

I have a directory #1 with:
- €œword document.docx€ -- the content is: abc
- €œexcel document.xlsx€
and another directory #2 with:
- €œword document.docx€ --the content is: def

When I move €œexcel document.xlsx€ from directory #1 to directory #2 I need
that the content of the cell, in excel, change from "abc" to "def". The cell
in excel have to be make with a relative path and not with an absolute path
to the file €œword document.docx€.

Can you help me?
Thanks