Saving a doc with name from doc text 
Author Message
 Saving a doc with name from doc text

I am new to VBA but find it interesting. Thanks in advance for any
help.

I want to save a Word document with the filename that is text
contained in the document.
I think I need to use a variable and the Save method. Any suggestions?



Tue, 14 Sep 2004 21:57:48 GMT  
 Saving a doc with name from doc text
Hi John,

Throw us a bone here. Do you want the filename to be the entire text of the
document?? Do you want to save the file without displaying the SaveAs dialog
box?

You don't really need to use a variable, and you can use the saveas method.

ActiveDocument.SaveAs _
    FileName:=Replace("C:\" & ActiveDocument.Words(3) & ".doc", " ", ""), _
    FileFormat:=wdFormatDocument

HTH

Quote:
> I am new to VBA but find it interesting. Thanks in advance for any
> help.

> I want to save a Word document with the filename that is text
> contained in the document.
> I think I need to use a variable and the Save method. Any suggestions?



Tue, 14 Sep 2004 22:27:30 GMT  
 Saving a doc with name from doc text
Dave,

My apologies for not being very clear (I am new to newsgroups as
well).

I would like the filename to be text from two different bookmarks in
the document that would be concatenated together.

Thanks again.

Quote:

> Hi John,

> Throw us a bone here. Do you want the filename to be the entire text of the
> document?? Do you want to save the file without displaying the SaveAs dialog
> box?

> You don't really need to use a variable, and you can use the saveas method.

> ActiveDocument.SaveAs _
>     FileName:=Replace("C:\" & ActiveDocument.Words(3) & ".doc", " ", ""), _
>     FileFormat:=wdFormatDocument

> HTH


> > I am new to VBA but find it interesting. Thanks in advance for any
> > help.

> > I want to save a Word document with the filename that is text
> > contained in the document.
> > I think I need to use a variable and the Save method. Any suggestions?



Wed, 15 Sep 2004 21:19:00 GMT  
 Saving a doc with name from doc text
Hi John,

Howzabout:

ActiveDocument.SaveAs "C:My Documents\" & ActiveDocument.Bookmarks _
    ("MyBookmark1").Range.Text &
ActiveDocument.Bookmarks("MyBookmark2").Range.Text

HTH,

Chris


Quote:
> Dave,

> My apologies for not being very clear (I am new to newsgroups as
> well).

> I would like the filename to be text from two different bookmarks in
> the document that would be concatenated together.

> Thanks again.




Quote:
> > Hi John,

> > Throw us a bone here. Do you want the filename to be the entire text of
the
> > document?? Do you want to save the file without displaying the SaveAs
dialog
> > box?

> > You don't really need to use a variable, and you can use the saveas
method.

> > ActiveDocument.SaveAs _
> >     FileName:=Replace("C:\" & ActiveDocument.Words(3) & ".doc", " ",
""), _
> >     FileFormat:=wdFormatDocument

> > HTH


> > > I am new to VBA but find it interesting. Thanks in advance for any
> > > help.

> > > I want to save a Word document with the filename that is text
> > > contained in the document.
> > > I think I need to use a variable and the Save method. Any suggestions?



Fri, 17 Sep 2004 02:21:00 GMT  
 Saving a doc with name from doc text
Hi Chris,

Too COOL. I am on the right track.
Any way to run this code from a protected form other than the Entry or
Exit macros on the form field.

Thanks again,
John

Quote:

> Hi John,

> Howzabout:

> ActiveDocument.SaveAs "C:My Documents\" & ActiveDocument.Bookmarks _
>     ("MyBookmark1").Range.Text &
> ActiveDocument.Bookmarks("MyBookmark2").Range.Text

> HTH,

> Chris



> > Dave,

> > My apologies for not being very clear (I am new to newsgroups as
> > well).

> > I would like the filename to be text from two different bookmarks in
> > the document that would be concatenated together.

> > Thanks again.



> > > Hi John,

> > > Throw us a bone here. Do you want the filename to be the entire text of
>  the
> > > document?? Do you want to save the file without displaying the SaveAs
>  dialog
> > > box?

> > > You don't really need to use a variable, and you can use the saveas
>  method.

> > > ActiveDocument.SaveAs _
> > >     FileName:=Replace("C:\" & ActiveDocument.Words(3) & ".doc", " ",
>  ""), _
> > >     FileFormat:=wdFormatDocument

> > > HTH


> > > > I am new to VBA but find it interesting. Thanks in advance for any
> > > > help.

> > > > I want to save a Word document with the filename that is text
> > > > contained in the document.
> > > > I think I need to use a variable and the Save method. Any suggestions?



Fri, 17 Sep 2004 23:55:12 GMT  
 Saving a doc with name from doc text
Hi John,

If you assign it to the keyboard or put a macro button on a toolbar, you can
run it from a protected form.

Please post any response to the newsgroups for the benefit of others who may
also be following the thread.

Hope this helps,
Doug Robbins - Word MVP

Quote:
> Hi Chris,

> Too COOL. I am on the right track.
> Any way to run this code from a protected form other than the Entry or
> Exit macros on the form field.

> Thanks again,
> John



Quote:
> > Hi John,

> > Howzabout:

> > ActiveDocument.SaveAs "C:My Documents\" & ActiveDocument.Bookmarks _
> >     ("MyBookmark1").Range.Text &
> > ActiveDocument.Bookmarks("MyBookmark2").Range.Text

> > HTH,

> > Chris



> > > Dave,

> > > My apologies for not being very clear (I am new to newsgroups as
> > > well).

> > > I would like the filename to be text from two different bookmarks in
> > > the document that would be concatenated together.

> > > Thanks again.



> > > > Hi John,

> > > > Throw us a bone here. Do you want the filename to be the entire text
of
> >  the
> > > > document?? Do you want to save the file without displaying the
SaveAs
> >  dialog
> > > > box?

> > > > You don't really need to use a variable, and you can use the saveas
> >  method.

> > > > ActiveDocument.SaveAs _
> > > >     FileName:=Replace("C:\" & ActiveDocument.Words(3) & ".doc", " ",
> >  ""), _
> > > >     FileFormat:=wdFormatDocument

> > > > HTH


> > > > > I am new to VBA but find it interesting. Thanks in advance for any
> > > > > help.

> > > > > I want to save a Word document with the filename that is text
> > > > > contained in the document.
> > > > > I think I need to use a variable and the Save method. Any

suggestions?


Sat, 18 Sep 2004 17:53:16 GMT  
 Saving a doc with name from doc text

Quote:
> Hi John,

> If you assign it to the keyboard or put a macro button on a toolbar, you can
> run it from a protected form.

> Please post any response to the newsgroups for the benefit of others who may
> also be following the thread.

> Hope this helps,
> Doug Robbins - Word MVP


> > Hi Chris,

> > Too COOL. I am on the right track.
> > Any way to run this code from a protected form other than the Entry or
> > Exit macros on the form field.

> > Thanks again,
> > John


> > > Hi John,

> > > Howzabout:

> > > ActiveDocument.SaveAs "C:My Documents\" & ActiveDocument.Bookmarks _
> > >     ("MyBookmark1").Range.Text &
> > > ActiveDocument.Bookmarks("MyBookmark2").Range.Text

> > > HTH,

> > > Chris



> > > > Dave,

> > > > My apologies for not being very clear (I am new to newsgroups as
> > > > well).

> > > > I would like the filename to be text from two different bookmarks in
> > > > the document that would be concatenated together.

> > > > Thanks again.



> > > > > Hi John,

> > > > > Throw us a bone here. Do you want the filename to be the entire text
>  of
>  the
> > > > > document?? Do you want to save the file without displaying the
>  SaveAs
>  dialog
> > > > > box?

> > > > > You don't really need to use a variable, and you can use the saveas
>  method.

> > > > > ActiveDocument.SaveAs _
> > > > >     FileName:=Replace("C:\" & ActiveDocument.Words(3) & ".doc", " ",
>  ""), _
> > > > >     FileFormat:=wdFormatDocument

> > > > > HTH


> > > > > > I am new to VBA but find it interesting. Thanks in advance for any
> > > > > > help.

> > > > > > I want to save a Word document with the filename that is text
> > > > > > contained in the document.
> > > > > > I think I need to use a variable and the Save method. Any
> suggestions?

To All,
Great help--thanks! ;)


Tue, 21 Sep 2004 22:38:50 GMT  
 
 [ 7 post ] 

 Relevant Pages 

1. Open word 97 doc with doc name as variable

2. Moving text from Doc to Doc

3. setting doc's save name

4. show save as dialog with default doc path but current file name

5. dynamically getting file name when saving DOC file in VB

6. Saving DOC as Text file

7. Saving a Word Doc with text from file

8. Auto Download of doc files into new doc file from a web site

9. Auto close open doc when opening another doc

10. pub doc and word doc on same screen

11. Open a doc, grab a range without having the whole doc being tabled

12. How do you drop doc files from a intranet site into a new word doc

 

 
Powered by phpBB® Forum Software