View Full Version : Export or copy module excel to word text
Felipe Dasi
07-13-2009, 05:02 AM
Como eu posso exportar ou copiar o módulo do excel para texto em word formatado, similar aos posts deste forum? obrigado.
How I can export or copy the module excel to word formatted text same posts this forum? thanks.
Benzadeus
07-14-2009, 01:19 PM
Vá, no editor do VBA, em Ferramentas / Referências e ative "Microsoft Visual Basic for Applications Extensibility X.X" e "Microsoft Word XX.X Object Library", onde X é um número qualquer.
Sub EnviaWord()
Dim oWa As Word.Application
Dim oWd As Word.Document
Dim vbP As VBIDE.VBProject
Dim vbC As VBIDE.VBComponent
Const strMódulo As String = "Módulo1" '<=== mude aqui conforme desejado
Set vbP = ActiveWorkbook.VBProject
Set vbC = ActiveWorkbook.VBProject.VBComponents(strMódulo)
Set oWa = CreateObject("Word.Application")
Set oWd = oWa.Documents.Add
oWa.Visible = True
oWd.Content.InsertAfter (vbC.CodeModule.Lines(1, vbC.CodeModule.CountOfLines))
oWd.Content.Font.Name = "Courier New (Ocidental)"
oWd.Content.Font.Size = 10
Set vbP = Nothing
Set vbC = Nothing
Set oWd = Nothing
Set oWa = Nothing
End Sub
Felipe Dasi
07-14-2009, 01:44 PM
Obrigado, benzadeus, era isso mesmoque precisava. abração. se precisar de algo estamos ai.
jingjing
06-06-2010, 06:51 PM
thank you, I have encountered in the learning journey for you.
aaaa123
10-14-2011, 01:47 AM
I just started to play the game,The future Exchange
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.