Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming,microsoft.public.word.vba.general
external usenet poster
 
Posts: 21
Default Setting Path for Word AND Excel

Hi ?B?I0RJVi8w?=,

Best would probably be to query it in every macro. I think that would be faster
than writing it to an outside file and having to open and read that.

I suppose you could save it as a custom document property in one or more files,
but I'm not sure that would be safer or more efficient. The DSOFile.exe should
let you do that without actually opening the files. You'll find information on
working with this on the word.mvps.org website.

I've been looking at all the posts I could find about globals but I can't get
a clear idea of how to set up a shared folder as the default. The Italian VBE
help files aren't much use.
Background: I have a Word .dot and an Excel .xla in the same folder. All
related secondary files (Excel Worksheets, other Word templates etc.) are in
this one folder that also contains the sub-folders for archiving new docs and
books that various Word and Excel macros create. I have Word and Excel (more
or less) happily talking to each other, creating stuff, updating stuff and
saving it correctly thanks to posts here and some other links (particularly
www.erlandsendata.no).
My remaining problem is that I need all folder tree references to work
whether I place this folder in "C:\" or
"F:\Documents\Whatever\SomethingElse\YetAnothe r\".
I figure one way in Excel would be to get ThisWorkbook.Path for the .xla
template Dim it as a String and there's probably something similar in Word.
But how exactly do I set these values as something I can call up in later
macros and UserForms based on these templates ?


Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 17 2005)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or reply
in the newsgroup and not by e-mail :-)

  #2   Report Post  
Posted to microsoft.public.excel.programming,microsoft.public.word.vba.general
external usenet poster
 
Posts: 30
Default Setting Path for Word AND Excel

Hi Cindy,
Not sure I understand your answer. Do you think I should start every single
Excel and Word macro with a check to find the base file path and set a value
to use within that macro ?
Seems clumsy. Is there really no way to set that as a global value ?


--
David M


"Cindy M." wrote:

Hi ?B?I0RJVi8w?=,

Best would probably be to query it in every macro. I think that would be faster
than writing it to an outside file and having to open and read that.

I suppose you could save it as a custom document property in one or more files,
but I'm not sure that would be safer or more efficient. The DSOFile.exe should
let you do that without actually opening the files. You'll find information on
working with this on the word.mvps.org website.

I've been looking at all the posts I could find about globals but I can't get
a clear idea of how to set up a shared folder as the default. The Italian VBE
help files aren't much use.
Background: I have a Word .dot and an Excel .xla in the same folder. All
related secondary files (Excel Worksheets, other Word templates etc.) are in
this one folder that also contains the sub-folders for archiving new docs and
books that various Word and Excel macros create. I have Word and Excel (more
or less) happily talking to each other, creating stuff, updating stuff and
saving it correctly thanks to posts here and some other links (particularly
www.erlandsendata.no).
My remaining problem is that I need all folder tree references to work
whether I place this folder in "C:\" or
"F:\Documents\Whatever\SomethingElse\YetAnothe r\".
I figure one way in Excel would be to get ThisWorkbook.Path for the .xla
template Dim it as a String and there's probably something similar in Word.
But how exactly do I set these values as something I can call up in later
macros and UserForms based on these templates ?


Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 17 2005)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or reply
in the newsgroup and not by e-mail :-)


  #3   Report Post  
Posted to microsoft.public.excel.programming,microsoft.public.word.vba.general
external usenet poster
 
Posts: 21
Default Setting Path for Word AND Excel

Hi ?B?I0RJVi8w?=,

Not sure I understand your answer. Do you think I should start every single
Excel and Word macro with a check to find the base file path and set a value
to use within that macro ?
Seems clumsy. Is there really no way to set that as a global value ?

It depends on how everything is supposed to work. A VBA project can have
"global variables", but they can go out of scope (the assigned values are lost
because the memory has been released). Since we don't know the details of your
entire project, it's therefore difficult to give a definitive answer.

Based on experience, you'd at least want to have a function at the beginning of
each procedure, or set of linked procedures, that requires this information to
check whether a global variable contains the information (Len(theVariable) 0)
and if it doesn't (empty string), call the procedure that gets the information.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 17 2005)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or reply
in the newsgroup and not by e-mail :-)

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
Setting up the defaults in Excel like Word Viol-8-r New Users to Excel 2 August 6th 09 04:52 PM
Setting a path to a folder Boots Excel Discussion (Misc queries) 2 August 10th 06 02:14 PM
Setting Default Save Path Corey Excel Programming 1 July 4th 06 01:17 AM
setting a dynamic path in an excel query Glen[_5_] Excel Programming 3 February 1st 06 04:35 PM
Setting a defaut path in a Macro David Excel Programming 2 July 30th 05 11:55 PM


All times are GMT +1. The time now is 04:56 AM.

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

About Us

"It's about Microsoft Excel"