Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 410
Default Activate Sheet After Move Macro

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
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,722
Default Activate Sheet After Move Macro

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!*


"jlclyde" wrote:

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

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 410
Default Activate Sheet After Move Macro

On Dec 17, 1:20*pm, Luke M wrote:
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!*



"jlclyde" wrote:
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- Hide quoted text -


- Show quoted text -


Neither of those work.
Jay
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Find account, move them to different sheet MACRO brodiemac Excel Discussion (Misc queries) 3 July 24th 08 07:49 PM
Move Column within Sheet with VB Macro Letzdo_1t Excel Discussion (Misc queries) 4 May 30th 07 11:43 PM
Macro to move data from one sheet to another Jurassien Excel Discussion (Misc queries) 0 January 22nd 07 10:22 PM
how do i write a macro to move down in the sheet one line ? surelystumped New Users to Excel 2 August 30th 06 05:44 PM
how would activate the previous sheet in macro Vicky Excel Discussion (Misc queries) 1 May 27th 06 09:18 AM


All times are GMT +1. The time now is 10:02 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"