Re: Path issues with the DIR function

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: John McGhie [MVP - Word] (john_at_mcghie.name)
Date: 05/10/04


Date: Tue, 11 May 2004 08:36:16 +1000

Hi John:

This responds to article <100520041424417229%js@classicmedia.tv>, from "Jon
Sherry" <js@classicmedia.tv> on 11/5/04 4:24 AM:

>> I seem to also remember that on the PC, the DIR command sets the Active
>> Path, whereas on the Mac it does not.
>
> Interesting. I assume the active path is like the current directory,
> i.e. if one executes DOS commands they execute in the Active Path. This
> same feature should work fine with the Unix shell, if MS implements it.

Yes, it is probably the "current directory" and I used the wrong term for
it. I doubt very much whether it will work in the Unix Shell, and since
Microsoft's stated position is no future development of VBA, I doubt if it
ever will.

All new stuff is going into dot-Net/C-sharp, and Microsoft has no plans to
bring that to the Mac. They are still waiting for sufficient demand to
appear on the Mac to justify a mega-expensive project to port dot-Net to the
Mac.

Dot-Net is huge, and there's just not enough installed base, let alone
solution development, happening on the Mac to make it worth it. But watch
this space: some of us are campaigning vigorously.

People here can help *a lot* by regularly writing or posting to MSWISH
asking for dot-Net, ActiveX or features they provide. You can search for
"mswish" in Google to get the correct addresses.

Hint: The first person to see your request won't have much comprehension of
it, so be polite, be supportive, and include justification for why you want
it giving examples of how you would use it. That way, someone who knows
dot-Net and the Mac well will be the next person to see your post :-)

Cheers
>
>>
>> However, I am wondering why you would not return the path you are seeking
>> directly with Application.NormalTemplate.Path... Or even
>> Application.StartupPath
>
> I'm setting the path to "install" the templates, using:
>
> Options.DefaultFilePath(wdUserTemplatesPath)
>
> Users will save the folder to their desktop, or go to a server volume,
> and run the installer from there. THe installer doc is in the same
> folder as the templates to be installed.
>
> I'm using ActiveDocument.Path to get the current location of the files,
> so it doesn't matter where the installer.doc is opened from.
>
>>
>> Putting your files in a folder of the correct name is not going to guarantee
>> success: you need to query Word to find out which path it is actually using.
>> The user can customise both his template location and his startup path, if
>> he does, your association will fail.
>
> This exactly what I said my initial post. I don't want to put an
> absolute path, nor do I want to make my ignorant users find their
> templates folder. That's why I've written a sub-routine to copy the
> templates set to their templates folder, after customizing them from a
> form they fill out.
>
> I've got a folder with an Install.doc and some templates to be
> installed into the user's user templates path. I want to get the path
> to the Installer folder, and then run Dir to loop through the templates
> in the folder, updating some fields on the templates, and then saving
> the templates to the templates path.
>
> Problem is that Dir only works when an absolute path is specified to
> the installer folder. I even tried getting the path to the installer
> with Application.MacroContainer.Path, but the same thing happens.
>
> The path looks correct, but Dir only finds the installer in the folder,
> instead of finding all the files, as it does when the path is absolute.
>
> hmm.
>
>
>>
>> Hope this helps
>>
>> This responds to article <070520041447367626%js@classicmedia.tv>, from "Jon
>> Sherry" <js@classicmedia.tv> on 8/5/04 4:47 AM:
>>
>>>
>>> Hi all,
>>> I'm working on a template installer that customizes a set of templates
>>> and then installs them into the user's default template folder. I've
>>> been getting the path with "ActiveDocument.Path" so that the installer
>>> will work regardless of where it's located, or what platform.
>>>
>>> Additionally, I want to use DIR to loop through the files in the
>>> Install Templates folder, so that additional templates can be added to
>>> the folder later without having to modify the program.
>>>
>>> Thing is, I discovered that if I set the path explicity:
>>>
>>> MyPath = "Macintosh HD:Users:jsherry:Desktop:Install:"
>>>
>>> Dir correctly loops the correct number of times, and returns the names
>>> of the files in the Install folder.
>>>
>>> If I set the path this way:
>>>
>>> MyPath = ActiveDocument.Path
>>>
>>> the scope of Dir is narrowed, and the loop iterates once, returning
>>> only the name of the ActiveDocument.
>>>
>>> Is there some way out of this? If I have to specify a path, then I'll
>>> need a different path for Mac and Windows, and maybe for OS9 and OSX,
>>> as well.
>>>
>>> I've only tested in Word v.X, 10.1.5, so far.
>>>
>>> Thanks, so much
>>> -jb

-- 
Please respond only to the newsgroup to preserve the thread.
John McGhie, Consultant Technical Writer,
McGhie Information Engineering Pty Ltd
Sydney, Australia.  GMT + 10 Hrs
+61 4 1209 1410, mailto:john@mcghie.name


Relevant Pages

  • Re: Im a Mac engineer ;-(
    ... it would just appear as an open folder. ... I could run the installer from there. ... why it is less common) it would do the same thing as the mac as well. ... practically identical on windows and OSX. ...
    (uk.comp.sys.mac)
  • Re: Path issues with the DIR function
    ... I'm setting the path to "install" the templates, ... Users will save the folder to their desktop, or go to a server volume, ... and run the installer from there. ... and then run Dir to loop through the templates ...
    (microsoft.public.mac.office.word)
  • Re: deleting unwanted themes and templates
    ... Then they didn't use the Windows Installer ... Prior Version themes were typically installed in the folder: ... To find the best Newsgroup for FrontPage support see: ... | I do not see any FP themes or templates listed there. ...
    (microsoft.public.frontpage.client)
  • RE: Returning the path to a misplaced Word Templates location
    ... Windows installer is able to query the registry and determine where Microsoft ... Word is looking for its templates. ... path to the Templates folder being used by Word. ... > the users StartupDir en then you could copy you're addin ...
    (microsoft.public.word.vba.customization)
  • Re: Inserting custom worksheets
    ... all would work if your installer app knows the templates ... Dim sXLTpath As String, sSep As String ... Guess your installer would first need to set a reference to user's Excel. ... > doesn't seem to be an easy way to determine where the default folder is ...
    (microsoft.public.excel.programming)