Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 265
Default Searching for a root directoty

Hi, I have a file (invent) in wich a Autoopen() macro was writed, the
autoopen macro opens a file named: c:/mis documentos/registros.xls, this file
is always saved in the same folder as the invent file, ¡How to tell excells
that the file registros.xls is in the same folder than invent.xls so when I
install both files in another computer I don need to change the autoopen
macro???
TVMIA
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,163
Default Searching for a root directoty

ThisWorkbook.FullName will give the file name including the path. The
following will strip away the file name, giving only the path:
FilePath = Left(ThisWorkbook.FullName,InStrRev(ThisWorkbook.F ullName,"\"))
You can then use this in your code to open the workbook:
Workbooks.Open FilePath & "registros.xls"


"filo666" wrote:

Hi, I have a file (invent) in wich a Autoopen() macro was writed, the
autoopen macro opens a file named: c:/mis documentos/registros.xls, this file
is always saved in the same folder as the invent file, ¡How to tell excells
that the file registros.xls is in the same folder than invent.xls so when I
install both files in another computer I don need to change the autoopen
macro???
TVMIA

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 265
Default Searching for a root directoty

thanks for your help in this an the other questions.

"K Dales" wrote:

ThisWorkbook.FullName will give the file name including the path. The
following will strip away the file name, giving only the path:
FilePath = Left(ThisWorkbook.FullName,InStrRev(ThisWorkbook.F ullName,"\"))
You can then use this in your code to open the workbook:
Workbooks.Open FilePath & "registros.xls"


"filo666" wrote:

Hi, I have a file (invent) in wich a Autoopen() macro was writed, the
autoopen macro opens a file named: c:/mis documentos/registros.xls, this file
is always saved in the same folder as the invent file, ¡How to tell excells
that the file registros.xls is in the same folder than invent.xls so when I
install both files in another computer I don need to change the autoopen
macro???
TVMIA

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 265
Default Searching for a root directoty

It works just as expected, ¿where you learn to VB programation??
some book that I could buy???

"filo666" wrote:

thanks for your help in this an the other questions.

"K Dales" wrote:

ThisWorkbook.FullName will give the file name including the path. The
following will strip away the file name, giving only the path:
FilePath = Left(ThisWorkbook.FullName,InStrRev(ThisWorkbook.F ullName,"\"))
You can then use this in your code to open the workbook:
Workbooks.Open FilePath & "registros.xls"


"filo666" wrote:

Hi, I have a file (invent) in wich a Autoopen() macro was writed, the
autoopen macro opens a file named: c:/mis documentos/registros.xls, this file
is always saved in the same folder as the invent file, ¡How to tell excells
that the file registros.xls is in the same folder than invent.xls so when I
install both files in another computer I don need to change the autoopen
macro???
TVMIA

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,163
Default Searching for a root directoty

There are many books available; I learned mostly by online documentation (but
I have several years experience programming in other languages)

My main sources of info we
Application help files - look for "Programming Information" in the contents
Web: there are many sites for VBA programming (Google search, or look
through these newsgroups for referenced sites)
Finally, MSDN knowledge base and library were helpful.

"filo666" wrote:

It works just as expected, ¿where you learn to VB programation??
some book that I could buy???

"filo666" wrote:

thanks for your help in this an the other questions.

"K Dales" wrote:

ThisWorkbook.FullName will give the file name including the path. The
following will strip away the file name, giving only the path:
FilePath = Left(ThisWorkbook.FullName,InStrRev(ThisWorkbook.F ullName,"\"))
You can then use this in your code to open the workbook:
Workbooks.Open FilePath & "registros.xls"


"filo666" wrote:

Hi, I have a file (invent) in wich a Autoopen() macro was writed, the
autoopen macro opens a file named: c:/mis documentos/registros.xls, this file
is always saved in the same folder as the invent file, ¡How to tell excells
that the file registros.xls is in the same folder than invent.xls so when I
install both files in another computer I don need to change the autoopen
macro???
TVMIA



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Searching for a root directoty

Just some added information.

ThisWorkbook.Path

gives just the path.

workbooks.Open thisworkbook.Path & "\registros.xls"

--
Regards,
Tom Ogilvy

"K Dales" wrote in message
...
ThisWorkbook.FullName will give the file name including the path. The
following will strip away the file name, giving only the path:
FilePath = Left(ThisWorkbook.FullName,InStrRev(ThisWorkbook.F ullName,"\"))
You can then use this in your code to open the workbook:
Workbooks.Open FilePath & "registros.xls"


"filo666" wrote:

Hi, I have a file (invent) in wich a Autoopen() macro was writed, the
autoopen macro opens a file named: c:/mis documentos/registros.xls, this

file
is always saved in the same folder as the invent file, ¡How to tell

excells
that the file registros.xls is in the same folder than invent.xls so

when I
install both files in another computer I don need to change the autoopen
macro???
TVMIA



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
Searching, matching then searching another list based on the match A.S. Excel Discussion (Misc queries) 1 December 13th 06 05:08 AM
12th root of two ksnapp[_53_] Excel Programming 6 April 14th 04 11:01 PM
Root of Sum Michael168[_70_] Excel Programming 1 March 6th 04 11:01 AM
Nth Root Samir[_2_] Excel Programming 1 February 18th 04 01:55 PM
windoes system directoty? John[_37_] Excel Programming 8 July 23rd 03 03:08 PM


All times are GMT +1. The time now is 12: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"