DDE - SaveAs in Word

I'm making a project in Access. And I need to send a SaveAs command to Word through a DDE channel. I know how to open the channel and things like that. All I need is the the SaveAs command, I need to pass along a paht that the current document is going to be saved to.
Who is Participating?
vboukharConnect With a Mentor Commented:
Look at sample below - it's open Wimword document via DDE channel and save it with new name. You can create string with desirable path and call it.
Sub wordDDE()
channelnumber = Application.DDEInitiate(app:="WinWord", topic:="System")
Application.DDEExecute channelnumber, "[FILEOPEN .Name = " & Chr(34) & "D:\ONE.DOC" & Chr(34) & "]"
Application.DDEExecute channelnumber, "[FILESAVEAS " & Chr(34) & "D:\TWO.DOC" & Chr(34) & "]"
Application.DDETerminate channelnumber
End Sub
All above - for Winword95 (for Winword97 maybe you have to use Open and SaveAs commants. But main idea - usage of chr(34) to create string for DDE command.)
Hope it hepls.
It is not the answer you are seeking, put perhaps it could suit you better. In the issue 4.29 of "woody's office watch" which I received today, Helen Fedema (seems to be a true Access guru) gives an example of, which, I quote from the description:

"In fact, I can even create a document (or template) from code, and put the doc properties into it, before creating a new document from the template, eliminating the need to distribute a Word template with the Access app, and any possible problems resulting from the user placing the template in the wrong location. "

If this interest you, I can give you more, otherwise disregard it.

You can do that using Word object from VBA. Look as sample below (Word95; I guess, it could run at Word97 too. If not - try to use CreateObject("Word.Application"), .Open  and .SaveAs commantd instead of .FileOpen and .FileSaveAs)
Sub WordTest()
    Dim WordObj As Object
    Set WordObj = CreateObject("Word.Basic")
    WordObj.AppHide "Microsoft Word"  ' hide Word
    WordObj.FileOpen "d:\old_one.doc"   ' open your file
    WordObj.FileSaveAs "D:\new_one.doc" ' string with new path/name
    WordObj.AppClose "Microsoft Word" ' close Word
    Set WordObj = Nothing
End Sub
Hope it helps.
P.S. It's not DDE, though...
Train for your Pen Testing Engineer Certification

Enroll today in this bundle of courses to gain experience in the logistics of pen testing, Linux fundamentals, vulnerability assessments, detecting live systems, and more! This series, valued at $3,000, is free for Premium members, Team Accounts, and Qualified Experts.


If you only need the command for SaveAs in Word and you've already got the document open then the following will do the trick.

Sub Saveas()
Dialogs(wdDialogFileSaveAs) = "C:\Your Directory"
End Sub


Hi, Oli!
Do you remember yet about this your question?

This question was awarded, but never cleared due to the JSP-500 errors of that time.  It was "stuck" against userID -1 versus the intended expert whom you awarded.  This corrects the problem and the expert will now receive these points; points verified.

Please click on your Member Profile and select "View Question History" to navigate through any open or locked questions you may have to update and finalize them.  If you are an EE Pro user, you can also choose Power Search to find all your open questions.

This is the Community Support link, if help is needed, along with the link to All Topics which reflects many TAs recently added.

Thank you,
Moderator @ Experts Exchange
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.