Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming,microsoft.public.word.vba.general
|
|||
|
|||
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
Posted to microsoft.public.excel.programming,microsoft.public.word.vba.general
|
|||
|
|||
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
Posted to microsoft.public.excel.programming,microsoft.public.word.vba.general
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Setting up the defaults in Excel like Word | New Users to Excel | |||
Setting a path to a folder | Excel Discussion (Misc queries) | |||
Setting Default Save Path | Excel Programming | |||
setting a dynamic path in an excel query | Excel Programming | |||
Setting a defaut path in a Macro | Excel Programming |