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
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
Do u want to save the word.doc without any prompt ???
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?
also, how do you kill off the application when you are finished with it... is there a Word.Application.Close?
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?
also, how do you kill off the application when you are finished with it... is there a Word.Application.Close?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
wdPromptToSaveChanges, or wdSaveChanges
Change the below Prompt to save without prompt :
On Error GoTo errorHandler
ActiveDocument.Close SaveChanges:=wdPromptToSav eChanges, OriginalFormat:=wdPromptUs er
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.
Change the below Prompt to save without prompt :
On Error GoTo errorHandler
ActiveDocument.Close SaveChanges:=wdPromptToSav
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.
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.
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???
About your horizontal lines: which lines???
ASKER
dont worry.. i figured it out. :)
i was referring to the wdBorderTop..
i was referring to the wdBorderTop..