Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Tim Tim is offline
external usenet poster
 
Posts: 408
Default go to the same path of the excel file being launched

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   Report Post  
Posted to microsoft.public.excel.programming
Tim Tim is offline
external usenet poster
 
Posts: 408
Default more explanation

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,080
Default more explanation

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
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
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
In Excel, why does my VB not work when launched from IE ? David C Excel Programming 3 March 21st 06 09:46 AM
Excel minimizes when a linked file launched Gregg Excel Discussion (Misc queries) 0 February 28th 06 05:11 PM
Excel updating from XML file - file path specific? Sean Excel Discussion (Misc queries) 4 August 5th 05 12:56 PM
Can you tell how Excel is launched? Gail Hurn Excel Programming 3 January 11th 05 05:47 PM


All times are GMT +1. The time now is 08:32 AM.

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

About Us

"It's about Microsoft Excel"