Opening a dot file as writeable file

M

Mindy

In VBA I want to open a template file, make changes and
save it. I am getting an error that the template file is
read only. WHen I open it, I have the following code:

Documents.Open FileName:=str_Filename, ReadOnly:=False

This isn't cutting it though. The file still opens read
only. Any ideas? Thanks.
 
D

Doug Robbins - Word MVP

Hi Mindy

Do you really want to make changes to the template and then save the
modified template, or do you want to create a new document from the template
and make the changes in that?

The latter would be more common and to do that you would use

Documents.Add Template: = str_Filename

Please respond to the newsgroups for the benefit of others who may be
interested.

Hope this helps
Doug Robbins - Word MVP
 
R

ralph

-----Original Message-----
Hi Mindy

Do you really want to make changes to the template and then save the
modified template, or do you want to create a new document from the template
and make the changes in that?

The latter would be more common and to do that you would use

Documents.Add Template: = str_Filename

Can you please expand on this. That is exactly the problem
I am having. I am trying to open a template file (in a
unique folder,i.e, outside the normal Office folders) that
is read-only.

Then create a document from it and save it. So my code
looks like this...

Dim moWDS As Word.Documents
Set moWDS = moWA.Documents

moWDS.Add Template:= "FormLetterTemplate.dot"
...
ActiveDocument.SaveAs FileName:="NewFormLetter.doc",
FileFormat:=wdFormatDocument, ReadOnlyRecommended:=True

I get an error saying can't save template to another
format. I have tried various combinations, but nothing
seems to work. At this point I am completely lost.

What am I missing?
Thanks,
-ralph
 
W

Word Heretic

G'day "ralph" <[email protected]>,

try

documents.Add str_Filename,,wdDocument


ralph said:
Can you please expand on this. That is exactly the problem
I am having. I am trying to open a template file (in a
unique folder,i.e, outside the normal Office folders) that
is read-only.

Then create a document from it and save it. So my code
looks like this...

Dim moWDS As Word.Documents
Set moWDS = moWA.Documents

moWDS.Add Template:= "FormLetterTemplate.dot"
...
ActiveDocument.SaveAs FileName:="NewFormLetter.doc",
FileFormat:=wdFormatDocument, ReadOnlyRecommended:=True

I get an error saying can't save template to another
format. I have tried various combinations, but nothing
seems to work. At this point I am completely lost.

What am I missing?
Thanks,
-ralph

Steve Hudson

Word Heretic, Sydney, Australia
Tricky stuff with Word or words for you.
Email: (e-mail address removed)
Products: http://www.geocities.com/word_heretic/products.html
Spellbooks: 728 pages of dump left and dropping...

The VBA Beginner's Spellbook: For all VBA users.
 

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