Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / November 2005

Tip: Looking for answers? Try searching our database.

Changing RTF file to Word Document

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
rmcompute - 25 Nov 2005 13:53 GMT
I save an Access report as a RTF document and would like from within Access
to convert it to a Word document.  I set up the code in Access as follows but
it does not save the file.  Can anyone help ?

 strF1Month = "FileName"

 Set docSource = wdApp.Documents.Open(strF1Month)
 docSource.SaveAs FileName:=strF1Month, FileFormat:=wdFormatDocument
Jonathan West - 25 Nov 2005 16:04 GMT
Various possible problems

1. The filename will probably actually be FileName.rtf rather than just
FileName

2. The filename that you save the document in Word format should be
FileName.doc. So you may need to do some processing of the strF1Month string
to get the extension right.

3. I would recommend you include the full pathname in strF1Month rather than
just the filename. That way you are not dependent on Word's current folder
happening to be where the file is located.

4. If you have not set a reference to the Word object model in Tools
References, and have instead set a late-bound reference to wdApp using
GetObject or CreateObject, then your code will not know the value of the
constant wdFormatDocument. Put its value in instead, which is 0.

Signature

Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup
Keep your VBA code safe, sign the ClassicVB petition www.classicvb.org

>I save an Access report as a RTF document and would like from within Access
> to convert it to a Word document.  I set up the code in Access as follows
[quoted text clipped - 5 lines]
>  Set docSource = wdApp.Documents.Open(strF1Month)
>  docSource.SaveAs FileName:=strF1Month, FileFormat:=wdFormatDocument
rmcompute - 26 Nov 2005 01:56 GMT
Thank you.

> Various possible problems
>
[quoted text clipped - 23 lines]
> >  Set docSource = wdApp.Documents.Open(strF1Month)
> >  docSource.SaveAs FileName:=strF1Month, FileFormat:=wdFormatDocument

Rate this thread:






 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.