CLR: .Net / Mono / Boo / Otros CLR > VB .NET

 Ayuda-necesito Crear Un Docemento Word Desde Vb

(1/1)

serbc25:
Hola a todos:

Tengo que hace run proyecto en vb que cuando pinche sobre el boton imprimir
me abra word con unos determiandos campos de la bd que no existen en el
formulario

Ejemplo

Formulario

ID: 4
Nombre: asda

Documento:

ID=4
Nombre=adas
Edad=asdas
Direccion=asdas

Tengo dudas si crear un documento con campos combinados o con marcas y lo
que no se es la instruccion par abrir el documento Word desde VB

Muchas gracias por adelantado

senzao18:
Creo que la clase Process podria ayudarte

System.Diagnostics.Process


--- Código: Text ---  En el siguiente ejemplo se utiliza una instancia de la clase Process para iniciar un proceso.[Visual Basic] Imports SystemImports System.DiagnosticsImports System.ComponentModel  Namespace MyProcessSample    _   '/ <summary>   '/ Shell for the sample.   '/ </summary>   Public Class MyProcess      ' These are the Win32 error code for file not found or access denied.      Private ERROR_FILE_NOT_FOUND As Integer = 2      Private ERROR_ACCESS_DENIED As Integer = 5                  '/ <summary>      '/ Prints a file with a .doc extension.      '/ </summary>      Public Sub PrintDoc()         Dim myProcess As New Process()                  Try            ' Get the path that stores user documents.            Dim myDocumentsPath As String = Environment.GetFolderPath(Environment.SpecialFolder.Personal)                        myProcess.StartInfo.FileName = myDocumentsPath + "\MyFile.doc"            myProcess.StartInfo.Verb = "Print"            myProcess.StartInfo.CreateNoWindow = True            myProcess.Start()         Catch e As Win32Exception            If e.NativeErrorCode = ERROR_FILE_NOT_FOUND Then               Console.WriteLine((e.Message + ". Check the path."))                        Else               If e.NativeErrorCode = ERROR_ACCESS_DENIED Then                  ' Note that if your word processor might generate exceptions                  ' such as this, which are handled first.                  Console.WriteLine((e.Message + ". You do not have permission to print this file."))               End If            End If         End Try      End Sub 'PrintDoc                  Public Shared Sub Main()         Dim myProcess As New MyProcess()         myProcess.PrintDoc()      End Sub 'Main   End Class 'MyProcessEnd Namespace 'MyProcessSample    

Navegación

[0] Índice de Mensajes

Ir a la versión completa