open word from vba outlook

  • Thread starter Thread starter Benji
  • Start date Start date
B

Benji

can anyone help me with this one. I want to open word without having to open
it manually as I am calling a filesaveas dialog for word.

Thanks
I currently have
Set wrd = GetObject(, "Word.Application")
wrd.Visible = True

wrd.Documents.Open "C:\My Documents\Temp.doc"
Set wrd = Nothing

but I am getting an error if word is not open
run-time error '429'
ActiveX component cant create object

and if it is open it will open it and present it but it gives me a vba error
run-time error 462
The remote server machine does not exist or is unavailable
 
Hi Benji,

first you call GetObject(, "Word.Application"). If it returns an error
then call CreateObject("Word.Application").
 
Michael

Thanks very much

I am using

Set Owrd = CreateObject("Word.Application")

'Owrd.Documents.Open "C:\Doc1.doc"

'On Error GoTo 0
With Dialogs(wdDialogFileSaveAs)
.Name = "c:\Data\"
.Show
End With

Owrd.Application.Quit

ANy idea why I might be getting the error 462 still.

run-time error 462
Plus I have tonnes of winword processes running after I run it a few times.

Thanks very much



End Sub
 
Hi Benji,

you´d need to set the Application´s Visible property=True.
Plus I have tonnes of winword processes running after I run it a few
times.

You could avoid that by following my suggestion.
 
Well ok thanks

I tried again but I keep getting the 462 error. Plus its not going to work
cause I want this to be used to save email messages to specific locations
and thats not going to work I dont think

this is my last code
Thanks if there is a way to call a DialogFileSaveAs with Outlook could you
let me know

Thanks

Sub SaveWWord()

Set wrd = CreateObject("Word.Application")
wrd.Visible = True
wrd.Documents.Open "c:\Doc1.doc"

On Error GoTo 0
With Dialogs(wdDialogFileSaveAs)
.Name = "c:\Data\"
.Show
End With


Set wrd = Nothing

End Sub
 
Benji,

for me the code works as it is, i.e.: starting a Word.Application,
opening an existing Document and showing the FileAs dialog. Where do you
get the error?

It´s a new issue in this discussion that you want to save e-mails. Why
do you want to use the Word dialog? Is it for the ability to select the
path, for saving the Body only, or anything else?
 
It´s a new issue in this discussion that you want to save e-mails. Why
do you want to use the Word dialog? Is it for the ability to select the
path, for saving the Body only, or anything else?


Ya sorry this wasnt mentioned earlier but I thought I was onto something. It
is for a graphical option for the ability to select the path for saving the
message. I dont know how else to do this. I want to save emails to a
location on our system but its always changing so I need to prompt my users
for a inputbox and then apply that to a dialog saveas box. I can t seem to
figure out the saveas Dialog box in Outlook or how else to call a saveas GUI
function from outlook. Therefore I was trying to user words for our email
messages But I cant get that to work errrr. Any ideas?

Thanks for the extra followup
 
Back
Top