Open Statement in Word X

  • Thread starter Michael Blaustein
  • Start date
M

Michael Blaustein

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
 
C

Corentin Cras-Méneur

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
 
J

John McGhie [MVP - Word]

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 said:
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:[email protected]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top