modificar word sin abrirlo en VB
Publicado por mapi (5 intervenciones) el 26/08/2008 11:07:11
Hola,
estoy haciendo una pequena aplicacion en Visual Basic. Quiero modificar el contenido de un documento word y guardarlo con un nombre. El problema es que no quiero que se me abra la pantalla del word, sino que el usuario no vea que se esta modificando un documento.
Todas las opciones que he encontrado me abren el word. y por mucho que lo haga no visible se me abre.
Aqui dejo el codigo. Por favor si alguien puede ayudarme estaria muy agradecida.
objWord.Documents.Open DocPath, False, True, False, , , False, , , 0
'Word Object is created - now let's fill it with data.
With objWord
.Visible = False
'move to each bookmark, and insert correct text.
.ActiveDocument.Bookmarks("first_name").Select
.Selection.Text = FirstName.Value
.ActiveDocument.Bookmarks("last_name").Select
.Selection.Text = LastName.Value
.ActiveDocument.Bookmarks("type").Select
.Selection.Text = certificationType
.ActiveDocument.Bookmarks("first_name2").Select
.Selection.Text = FirstName.Value '(CStr(Forms!Modify_form!FirstName))
.ActiveDocument.Bookmarks("date").Select
.Selection.Text = Format(Now(), "mmmm dd, yyyy")
End With
' Save the document with the name of the worker and the date
documentName ="modocumento"
'specific to this app
objWord.ActiveDocument.SaveAs folderPath & documentName, , , , True 'vDocDir & "" &
objWord.ActiveDocument.Close True
objWord.Quit
estoy haciendo una pequena aplicacion en Visual Basic. Quiero modificar el contenido de un documento word y guardarlo con un nombre. El problema es que no quiero que se me abra la pantalla del word, sino que el usuario no vea que se esta modificando un documento.
Todas las opciones que he encontrado me abren el word. y por mucho que lo haga no visible se me abre.
Aqui dejo el codigo. Por favor si alguien puede ayudarme estaria muy agradecida.
objWord.Documents.Open DocPath, False, True, False, , , False, , , 0
'Word Object is created - now let's fill it with data.
With objWord
.Visible = False
'move to each bookmark, and insert correct text.
.ActiveDocument.Bookmarks("first_name").Select
.Selection.Text = FirstName.Value
.ActiveDocument.Bookmarks("last_name").Select
.Selection.Text = LastName.Value
.ActiveDocument.Bookmarks("type").Select
.Selection.Text = certificationType
.ActiveDocument.Bookmarks("first_name2").Select
.Selection.Text = FirstName.Value '(CStr(Forms!Modify_form!FirstName))
.ActiveDocument.Bookmarks("date").Select
.Selection.Text = Format(Now(), "mmmm dd, yyyy")
End With
' Save the document with the name of the worker and the date
documentName ="modocumento"
'specific to this app
objWord.ActiveDocument.SaveAs folderPath & documentName, , , , True 'vDocDir & "" &
objWord.ActiveDocument.Close True
objWord.Quit
Valora esta pregunta


0