Link to home
Start Free TrialLog in
Avatar of Sesh
Sesh

asked on

Saving a document created with vb in word

i have externally created a word document from my vb application, and it has opened word, added a document (documents.add) and written stuff to the selection.

how do you save the document without a prompt as a certain filename... i dont want it to be called "document 1.txt" or anything like that. OR... if i MUST have a prompt, (as in, if i just go.. documents.save true, true) how do i allow it to overwrite files already there?

thanx
Avatar of amuru
amuru

Do u want to save the word.doc without any prompt ???
Avatar of Sesh

ASKER

yes... i want to save it as a specific filename without prompting

also, how do you kill off the application when you are finished with it... is there a Word.Application.Close?
Avatar of Sesh

ASKER

yes... i want to save it as a specific filename without prompting

also, how do you kill off the application when you are finished with it... is there a Word.Application.Close?
ASKER CERTIFIED SOLUTION
Avatar of Éric Moreau
Éric Moreau
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
wdPromptToSaveChanges, or wdSaveChanges

Change the below Prompt to save without prompt :

On Error GoTo errorHandler
ActiveDocument.Close SaveChanges:=wdPromptToSaveChanges, OriginalFormat:=wdPromptUser
errorHandler:
If Err = 4198 Then MsgBox "Document was not closed"

to kill the Application use :
goWord.quit

set goWord = Nothing

Above is just the command to close opened word.  Add some coding to check activedocument.
Avatar of Sesh

ASKER

thanx a lot for that... its exactly what i was looking for

just one other thing, though... how do you insert tabs, create tabstops and insert those horizontal lines that appear when you type

---------

on a new line????

help in this would be really great.
I never played with tabs by automation so can't help on this one.

About your horizontal lines: which lines???
Avatar of Sesh

ASKER

dont worry.. i figured it out. :)

i was referring to the wdBorderTop..