Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi All,
This macro: Sub GetData() With Range("F1:F10") .Formula = "='C:\Documents and Settings\Tim\Desktop\test\[Book1.xls]Sheet1'!A1" .Formula = .Value End With End Sub works fine but i need to change the line: ..Formula = "='C:\Documents and Settings\Tim\Desktop\test\[Book1.xls]Sheet1'!A1" Instead to go to that directory above, to go to the folder test which is in the same path of the excel file being launched. Something like this: ..Formula =ThisWorkbook.Path & "\test\Book1.xls" Any Help is highly appreciated. Tim |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
In my previous posting i mean i need to change the
line: ..Formula = "='C:\Documents and Settings\Tim\Desktop\test\[Book1.xls]Sheet1'!A1" to something like this: ..Formula =ThisWorkbook.Path & "\test\[Book1.xls]Sheet1'!A1" As you can guess the second line is only guided. It doesnt work and i need your help to fix it. Tim "Tim" wrote: Hi All, This macro: Sub GetData() With Range("F1:F10") .Formula = "='C:\Documents and Settings\Tim\Desktop\test\[Book1.xls]Sheet1'!A1" .Formula = .Value End With End Sub works fine but i need to change the line: .Formula = "='C:\Documents and Settings\Tim\Desktop\test\[Book1.xls]Sheet1'!A1" Instead to go to that directory above, to go to the folder test which is in the same path of the excel file being launched. Something like this: .Formula =ThisWorkbook.Path & "\test\Book1.xls" Any Help is highly appreciated. Tim |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Try something like:
..Formula = "=" & ThisWorkbook.Path & "\test\[Book1.xls]Sheet1'!A1" "Tim" wrote in message ... In my previous posting i mean i need to change the line: .Formula = "='C:\Documents and Settings\Tim\Desktop\test\[Book1.xls]Sheet1'!A1" to something like this: .Formula =ThisWorkbook.Path & "\test\[Book1.xls]Sheet1'!A1" As you can guess the second line is only guided. It doesn't work and i need your help to fix it. Tim "Tim" wrote: Hi All, This macro: Sub GetData() With Range("F1:F10") .Formula = "='C:\Documents and Settings\Tim\Desktop\test\[Book1.xls]Sheet1'!A1" .Formula = .Value End With End Sub works fine but i need to change the line: .Formula = "='C:\Documents and Settings\Tim\Desktop\test\[Book1.xls]Sheet1'!A1" Instead to go to that directory above, to go to the folder test which is in the same path of the excel file being launched. Something like this: .Formula =ThisWorkbook.Path & "\test\Book1.xls" Any Help is highly appreciated. Tim |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Formula too long - new file path is shorter than old file path - Excel 2003 | Excel Worksheet Functions | |||
In Excel, why does my VB not work when launched from IE ? | Excel Programming | |||
Excel minimizes when a linked file launched | Excel Discussion (Misc queries) | |||
Excel updating from XML file - file path specific? | Excel Discussion (Misc queries) | |||
Can you tell how Excel is launched? | Excel Programming |