Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 'Se agrega la libreria para manejar aplicaciones word
- 'Se agrega la referencia al proyecto de microsoft word object library
- Imports Microsoft.Office.Interop
- Public Class Form1
- Private Sub btncrear_Click(sender As Object, e As EventArgs) Handles btncrear.Click
- 'Declara la variable.
- Dim objWD As Word.Application
- 'Crea una nueva instancia de Word
- objWD = CreateObject("Word.Application")
- 'Agrega un nuevo documento en blanco
- objWD.Documents.Add()
- 'Agrega Texto.
- objWD.Selection.TypeText("Hola mundo")
- 'Guarda el documento
- objWD.ActiveDocument.SaveAs(FileName:="cotizacion.doc")
- 'Declaramos la variable para abrir el documento y se le asigna el valor al objeto y especificamos el nombre del documento a abrir
- Dim archivoWord = objWD.Documents.Open(FileName:="cotizacion.doc")
- End Sub
- End Class
Add Comment
Please, Sign In to add comment