AJUDA CONVERTER VBS PARA VB.NET

ALEVALE 29/05/2012 12:52:01
#403073
Alguém poderia dar uma força para converter esse código VBS em VB.NET ?
Não se preocupem com os dados do usuário, preciso so dá parte do (Word.Application) para baixo.

On Error Resume Next

Set objSysInfo = CreateObject([Ô]ADSystemInfo[Ô])

strUser = objSysInfo.UserName
Set objUser = GetObject([Ô]LDAP://[Ô] & strUser)

strName = objUser.FullName
strTitle = objUser.Title
strDepartment = objUser.Department
strCompany = objUser.Company
strPhone = objUser.telephoneNumber

Set objWord = CreateObject([Ô]Word.Application[Ô])

Set objDoc = objWord.Documents.Add()
Set objSelection = objWord.Selection

Set objEmailOptions = objWord.EmailOptions
Set objSignatureObject = objEmailOptions.EmailSignature

Set objSignatureEntries = objSignatureObject.EmailSignatureEntries

objSelection.TypeText strName & [Ô], [Ô] & strTitle
objSelection.TypeParagraph()
objSelection.TypeText strDepartment
objSelection.TypeParagraph()
objSelection.TypeText strCompany
objSelection.TypeParagraph()
objSelection.TypeText strPhone

Set objSelection = objDoc.Range()

objSignatureEntries.Add [Ô]AD Signature[Ô], objSelection
objSignatureObject.NewMessageSignature = [Ô]AD Signature[Ô]
objSignatureObject.ReplyMessageSignature = [Ô]AD Signature[Ô]

objDoc.Saved = True
objWord.Quit
ALEVALE 29/05/2012 13:02:46
#403074
Eu estou tentando assim mas não funciona...

On Error Resume Next
Dim Word_VB As New Word.Application
Dim strLink As String
Dim objEmailOptions As String = Word_VB.EmailOptions
Dim objSignatureObject As String = Word_VB.EmailOptions.EmailSignature
Dim objSignatureEntries As String = Word_VB.EmailSignatureEntries

[ô]MONTA ARQUIVO WORD
Word_VB.Documents.Add()
Word_VB.Visible = True

With Word_VB
[ô]IMAGEM
[ô].Selection.InlineShapes.AddPicture(FileName:=[Ô]C:\Program Files\Microsoft Games\Chess\ChessMCE.png[Ô], LinkToFile:=False, SaveWithDocument:=True)
[ô].Selection.TypeText(Chr(11))

[ô]NOME
.Selection.Font.Size = 10
.Selection.Font.Bold = True
.Selection.Font.Name = [Ô]Century Gothic[Ô]
.Selection.Font.Color = RGB(15, 36, 62)
.Selection.TypeText(Text:=strNome)
.Selection.TypeText(Chr(11))

[ô]EMPRESA
.Selection.Font.Name = [Ô]Century Gothic[Ô]
.Selection.Font.Bold = False
.Selection.Font.Size = 10
.Selection.Font.Color = 0
.Selection.TypeText(strEmpresa)
.Selection.TypeText(Chr(11))

[ô]CARGO
.Selection.Font.Name = [Ô]Century Gothic[Ô]
.Selection.Font.Bold = False
.Selection.Font.Size = 10
.Selection.Font.Color = 0
.Selection.TypeText(strCargo)
.Selection.TypeText(Chr(11))

[ô]TELEFONE/FAX
.Selection.Font.Color = RGB(38, 38, 38)
[ô]CELULAR
If strCelular <> [Ô][Ô] Then
.Selection.TypeText([Ô]T [Ô] + strTelefone + [Ô] / [Ô] + [Ô]C [Ô] + strCelular)
Else
.Selection.TypeText([Ô]T [Ô] + strTelefone)
End If

.Selection.TypeText(Chr(11))
.Selection.TypeText([Ô]F [Ô] + strFax)
.Selection.TypeText(Chr(11))
.Selection.Font.Color = RGB(23, 54, 93)
.Selection.Hyperlinks.Add(.Selection.Range, strSiteEmpresa, , strSiteEmpresa, strSiteEmpresa)

[ô]E-MAIL
.Selection.Font.Name = [Ô]Century Gothic[Ô]
.Selection.Font.Bold = False
.Selection.Font.Size = 10
.Selection.Font.Color = 0
.Selection.Hyperlinks.Add(.Selection.Range, strEmail, , [Ô][Ô], [Ô][Ô])
.Selection.TypeText(Chr(11))

[ô]DISCLAMMER
.Selection.TypeText(Chr(11))
.Selection.Font.Name = [Ô]Webdings[Ô]
.Selection.Font.Size = [Ô]14″[Ô]
.Selection.Font.Color = RGB(115, 155, 63)
.Selection.TypeText([Ô]P [Ô])
.Selection.Font.Name = [Ô]Calibri[Ô]
.Selection.Font.Size = [Ô]9″[Ô]
.Selection.TypeText([Ô]Please consider the environment before printing this e-mail.[Ô])
End With

[ô]SETA O ARQUIVO COMO ASSINATURA PRINCIPAL
Word_VB.Add([Ô]Standard Signature[Ô], Word_VB)
Word_VB.NewMessageSignature = [Ô]Standard Signature[Ô]
Word_VB.ReplyMessageSignature = [Ô]Standard Signature[Ô]

[ô]SALVA DOCUMENTO
Word_VB.Saved = True
Word_VB.Quit()
Word_VB = Nothing

[ô]FINALIZA
End
AJSO 29/05/2012 19:57:53
#403110
Caro ALEVALE

[ô]Declara estas variáveis no cabeçalho
[ô]Imports
Imports Microsoft.VisualBasic
[ô]Vai precisar também definir as seguinte variáveis:
Dim objWord As Object
Dim i As Integer

[ô]Continua assim em um controle ou evento


Try

[Ô]Instancia a Aplicação Word.

objWord = CreateObject([Ô]Word.Application[Ô])

[Ô]Abre o documento aviso.doc do Microsoft Word.

objWord.Documents.Open([Ô]d:    este\aviso.doc[Ô])

[Ô]Percorre o seu objeto para preencher

[ô]Seu código......................................................................


Catch ex As Exception

objWord.ActiveDocument.Close(False)
objWord.Quit()

objWord = Nothing

MsgBox(ex.Message)

EndTry


[ô]Depois é só fechar o objeto com ua Sub()


Private Sub CloseWord()

[Ô]Fecha o documento Word sem salvar
objWord.ActiveDocument.Close(False)
[Ô]Fecha o Word
objWord.Quit()
objWord = Nothing
End Sub



boa Sorte
Tópico encerrado , respostas não são mais permitidas