Re: File Open Dialog based on startup directory by Steve
Steve
Sat Aug 20 22:11:35 CDT 2005
I understand exactly what you're saying and you're likely correct about what
the original poster is asking about. However, when I read the example that
the poster placed above my first post, I believe there is a chance that even
though he says he wants the file open directory to be the directory from
which he opened Word, I think he might actually mean that he might want Word
to recognize the current directory he was in under the command prompt
directory when he chose to launch Word.
He says,
>>> c:\abc\xyz> winword.exe (assuming winword.exe is in the system path)
>>>
>>> Now I want the File-Open dialog box to point to c:\abc\xyz.
I don't think he means that winword.exe is in c:\abc\xyz, rather, I think
c:\abc\xyz is an arbitrary path he wants to be able to navigate to and then
launch Word from the command prompt and have it recognize that he was in
c:\abc\xyz when he chose to do so.
Steve
"Jezebel" <warcrimes@whitehouse.gov> wrote in message
news:evloSvfpFHA.1948@TK2MSFTNGP12.phx.gbl...
> Steve, I think you've missed the point of the thread. First, if the user
> is starting Word from within a given directory, that directory necessarily
> exists, so there's no point in checking for that. Second,
> ChangeFileOpenDirectory doesn't work for the required purpose.
>
> Try this:
>
> 1. Start Word from the command line, in a folder that Word doesn't
> normally use for opening or saving.
>
> 2. In Word's VBA immediate window, type : ? CurDir. You'll see the name of
> the folder you started Word from.
>
> 3. type: ChangeFileOpenDirectory CurDir
>
> 4. Switch back to Word's main window and use File > Open.
>
>
>
>
>
> "Steve Yandl" <syandl_nospam@comcast.net> wrote in message
> news:BpWdnbWRp_-ge5reRVn-og@comcast.com...
>> Assuming my assumptions above are correct, try this. Create a new text
>> file named "myWord.vbs" and store in in your Windows folder or somewhere
>> else in the system path. Edit this text document to contain the
>> following lines:
>>
>> Dim fso, objWord
>> Set fso = CreateObject("Scripting.FileSystemObject")
>> If Not fso.FolderExists (WScript.Arguments.Item(0)) Then
>> MsgBox "You messed up the command line"
>> Else
>> Set objWord = CreateObject("Word.Application")
>> objWord.Application.ChangeFileOpenDirectory(Wscript.Arguments.Item(0))
>> objWord.Visible = True
>> End If
>>
>> After saving the edited version of the vbs file, open cmd.exe. Change to
>> your preferred file open directory and then enter the line:
>> myWord "%cd%"
>> See if Word doesn't open with the default file open folder where you
>> want.
>>
>> Steve
>> "Anand" <aanandgAThotmail.nospam.com> wrote in message
>> news:47DA6BFD-BD0E-4BFD-AC1F-E7AFE2BBE101@microsoft.com...
>>> Thanks - but no, but this doesn't seem to work. This macro appears to
>>> set the
>>> file-open directory to the value specified by
>>> Tools->Options->FileLocations->Startup
>>>
>>> I realize now that my email title may be misleading since your solution
>>> does
>>> refer to a startup directory. What I'm looking for is the directory from
>>> which I launch winword.exe (assuming I launch it from the command line).
>>> Suppose the following commands are executed:
>>>
>>> c:\> cd abc\xyz
>>> c:\abc\xyz> winword.exe (assuming winword.exe is in the system path)
>>>
>>> Now I want the File-Open dialog box to point to c:\abc\xyz.
>>>
>>> -Anand.
>>>
>>> "Jezebel" wrote:
>>>
>>>> In theory,
>>>>
>>>> ChangeFileOpenDirectory CurDir
>>>>
>>>> not sure that it actually works, though.
>>>>
>>>>
>>>>
>>>> "Anand" <aanandgAThotmail.nospam.com> wrote in message
>>>> news:9291FC52-FD2F-40CB-BE50-23F7FFB2E884@microsoft.com...
>>>> > Hi,
>>>> >
>>>> > I'd like for word's File-Open & Save-As dialogs to point to the
>>>> > directory
>>>> > from which I launched word. For example, I might just launch
>>>> > winword.exe
>>>> > from
>>>> > the command line, say in directory: c:\abc\xyz in which case I'd like
>>>> > for
>>>> > File-Open & Save-As to point to this directory. Could you point me to
>>>> > suitable VBA source-code or inbuilt word menu options by which I can
>>>> > achieve
>>>> > this ?
>>>> >
>>>> > Thanks,
>>>> > Anand.
>>>>
>>>>
>>>>
>>
>>
>
>