Activate Sheet After Move Macro

J

jlclyde

When this macro runs it leaves the screen on the VBA window on the
code that was moved. How do you activate the sheet?

Thanks,
Jay


Sub ExportCodeMod()
Dim strCode As String
Dim vbCom As VBComponent
Dim modObj As Object

' Set object to the module you want to export.
Set modObj = _
Application.VBE.ActiveVBProject.VBComponents.Item("modTest")
' Place code in a string.
strCode = modObj.CodeModule.Lines(1, modObj.CodeModule.CountOfLines)
' Open workbook.
Workbooks.Open Filename:="G:\New Items\Forms\Proposal Sheet.xls",
ReadOnly:=True
' Create a new module in workbook.
Application.VBE.ActiveVBProject.VBComponents.Add (vbext_ct_StdModule)
' Add code to new module from string variable.
Application.VBE.ActiveVBProject.VBComponents.Item("Module1") _
.CodeModule.AddFromString (strCode)

End Sub
 
L

Luke M

After your Dim callouts, you could try adding
application.screenupdating=false
and
application.screenupdating=true
at the end.

Other idea is to include
Workbook("G:\New Items\Forms\Proposal Sheet.xls").activate
at the end
 
J

jlclyde

After your Dim callouts, you could try adding
application.screenupdating=false
and
application.screenupdating=true
at the end.

Other idea is to include
Workbook("G:\New Items\Forms\Proposal Sheet.xls").activate
at the end
--
Best Regards,

Luke M
*Remember to click "yes" if this post helped you!*







- Show quoted text -

Neither of those work.
Jay
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top