- Como posso copiar o conteúdo de um módulo para outro em outra planilha?
Sub CopyMod (SourceWB As Workbook, strModuleName As String, TargetWB As Workbook)
' CopyMod Workbooks("BernardesPlan01.xls"), "mdl_Functions", Workbooks("
BernardesPlan02
.xls")
Dim strFolder As String, strTempFile As String
Let strFolder = SourceWB.Path
If Len(strFolder) = 0 Then strFolder = CurDir
Let strFolder = strFolder & "\"
Let strTempFile = strFolder & "~tmpexport.bas"
On Error Resume Next
SourceWB.VBProject.VBComponents(strModuleName).Export strTempFile
TargetWB.VBProject.VBComponents.Import strTempFile
Kill strTempFile
On Error GoTo 0
End Sub
Tags: Bernardes, MS, Microsoft, Office, Excel, copy, module, code, workbook
André Luiz Bernardes
André Luiz Bernardes
Nenhum comentário:
Postar um comentário