View Full Version : Open Statement in Word X


Michael Blaustein
07-07-2003, 04:15 PM
Hi. I am trying to use the Open statement to write a profile for a template
to a file, kind of like this:

Filenumber = freefile
Open "~/Library/UserInfo1.txt" for Append As #Filenumber
Write #Filenumber, "User Info"
Close #Filenumber

As you can see by the filepath in the Open statement, I wish to save this
file in the User's Library directory. However, what it appears to be doing
instead is creating a file in whatever the current directory is called
"~/Library/UserInfo1.txt". The filename itself has the tilda and the
slashes in it, as opposed to it seeing the tilda and slashes as the path to
the file. I have also attempted this with backslashes ( \ ) to no avail.
Is there anyone who can help point me in the right direction? Thank you in
advance.
Michael Blaustein

=?ISO-8859-1?Q?Corentin_Cras-M=E9neur?=
07-08-2003, 12:00 AM
Michael Blaustein <scopius[at]earthlink.net> wrote:

Hi Michael,

> Hi. I am trying to use the Open statement to write a profile for a template
> to a file, kind of like this:
>
> Filenumber = freefile
> Open "~/Library/UserInfo1.txt" for Append As #Filenumber
> Write #Filenumber, "User Info"
> Close #Filenumber
>
> As you can see by the filepath in the Open statement, I wish to save this
> file in the User's Library directory. However, what it appears to be doing
> instead is creating a file in whatever the current directory is called
> "~/Library/UserInfo1.txt". The filename itself has the tilda and the
> slashes in it, as opposed to it seeing the tilda and slashes as the path to
> the file. I have also attempted this with backslashes ( \ ) to no avail.
> Is there anyone who can help point me in the right direction? Thank you in
> advance.


I have problems with my current setup so I cannot test it right now but
I know that Office has a very hard time with relative paths (that's the
essence of my current problems). You should try using absolute paths
(eg: MyDrive/Users/me/Library/UserInfo1.txt) instead of the relative
path through the tilde to see if it works.
This could be a real problem if the tilde is the issue and you want to
distribute the macro but I believe this test should tell you where the
problem resides.


Corentin


--
- Mac MVP (Francophone) -

http://support.microsoft.com/default.aspx?ln=FR&scid=fh;FR;mvp
http://www.microsoft.com/FRANCE/Support/home/Newsgroup.Asp

John McGhie [MVP - Word]
07-08-2003, 03:59 AM
Hi Michael:

Mac Word has an "advanced" case of the PC's behaviour, which I am trying
very hard to get Microsoft to change.

In Word Mac, the current file location for "Open" and the file location for
"Save" are different. On the PC, if you Open a file, it updates the Save
path to the location of the file you opened. On the Mac, it doesn't.

So you will need to specify your path explicitly when you save to be safe.

Hope this helps

This responds to microsoft.public.mac.office.word on Mon, 7 Jul 2003
11:15:27 -0400, "Michael Blaustein" <scopius[at]earthlink.net>:

> Hi. I am trying to use the Open statement to write a profile for a template
> to a file, kind of like this:
>
> Filenumber = freefile
> Open "~/Library/UserInfo1.txt" for Append As #Filenumber
> Write #Filenumber, "User Info"
> Close #Filenumber
>
> As you can see by the filepath in the Open statement, I wish to save this
> file in the User's Library directory. However, what it appears to be doing
> instead is creating a file in whatever the current directory is called
> "~/Library/UserInfo1.txt". The filename itself has the tilda and the
> slashes in it, as opposed to it seeing the tilda and slashes as the path to
> the file. I have also attempted this with backslashes ( \ ) to no avail.
> Is there anyone who can help point me in the right direction? Thank you in
> advance.
> Michael Blaustein
>

Please post all comments to the newsgroup to maintain the thread.

John McGhie, Consultant Technical Writer
McGhie Information Engineering Pty Ltd
Sydney, Australia. GMT + 10 Hrs
+61 4 1209 1410, mailto:john[at]mcghie-information.com.au