Olli083097
asked on
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.
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.Applica tion"), .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...
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...
Olli
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()
ActiveDocument
Dialogs(wdDialogFileSaveAs ) = "C:\Your Directory"
End Sub
Regards
Nick
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()
ActiveDocument
Dialogs(wdDialogFileSaveAs
End Sub
Regards
Nick
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Hi, Oli!
Do you remember yet about this your question?
Do you remember yet about this your question?
GREETINGS!
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.
https://www.experts-exchange.com/jsp/qList.jsp?ta=commspt
https://www.experts-exchange.com/jsp/zonesAll.jsp
Thank you,
Moondancer
Moderator @ Experts Exchange
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.
https://www.experts-exchange.com/jsp/qList.jsp?ta=commspt
https://www.experts-exchange.com/jsp/zonesAll.jsp
Thank you,
Moondancer
Moderator @ Experts Exchange
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.
\cri