Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 74
Default Select specific Project in VBA

Hi
I want to create code using the sendkeys( I know they are not very realiable
but this is all I can do) to remove the project protection off a certain
project however I am not sure how to select the project via sendkeys.

We have multiple hiden sheets which are avilable in VBA but I need to select
one called First.

Any idea how to do this.

Thanks
Noemi
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Select specific Project in VBA

Noemi,

Try something

Set Application.VBE.ActiveVBProject = Workbooks("Book1.xls").VBProject

This will select the Book1.xls project in the VBE. You can't make a
components active if the project is locked. Once you've unlocked the
project, you can make a component active with

Set Application.VBE.ActiveCodePane = _
Workbooks("Book4.xls").VBProject.VBComponents("Fir st").CodeModule.CodePane


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
www.cpearson.com
(email address is on the web site)

"Noemi" wrote in message
...
Hi
I want to create code using the sendkeys( I know they are not very
realiable
but this is all I can do) to remove the project protection off a certain
project however I am not sure how to select the project via sendkeys.

We have multiple hiden sheets which are avilable in VBA but I need to
select
one called First.

Any idea how to do this.

Thanks
Noemi



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Select specific Project in VBA

I should have added that in the second line of code "first" refers to the
CodeName of the worksheet, not the name of the worksheet as shown in the
tabs. If you need to use the tab name, use code like


With Workbooks("Book4.xls").Worksheets("TabName")
Set Application.VBE.ActiveCodePane = _
.Parent.VBProject.VBComponents(.CodeName).CodeModu le.CodePane
End With


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
www.cpearson.com
(email address is on the web site)


"Chip Pearson" wrote in message
...
Noemi,

Try something

Set Application.VBE.ActiveVBProject = Workbooks("Book1.xls").VBProject

This will select the Book1.xls project in the VBE. You can't make a
components active if the project is locked. Once you've unlocked the
project, you can make a component active with

Set Application.VBE.ActiveCodePane = _

Workbooks("Book4.xls").VBProject.VBComponents("Fir st").CodeModule.CodePane


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
www.cpearson.com
(email address is on the web site)

"Noemi" wrote in message
...
Hi
I want to create code using the sendkeys( I know they are not very
realiable
but this is all I can do) to remove the project protection off a certain
project however I am not sure how to select the project via sendkeys.

We have multiple hiden sheets which are avilable in VBA but I need to
select
one called First.

Any idea how to do this.

Thanks
Noemi





  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 74
Default Select specific Project in VBA

Chip
Thank you so much, it worked.

Thanks
Noemi

"Chip Pearson" wrote:

I should have added that in the second line of code "first" refers to the
CodeName of the worksheet, not the name of the worksheet as shown in the
tabs. If you need to use the tab name, use code like


With Workbooks("Book4.xls").Worksheets("TabName")
Set Application.VBE.ActiveCodePane = _
.Parent.VBProject.VBComponents(.CodeName).CodeModu le.CodePane
End With


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
www.cpearson.com
(email address is on the web site)


"Chip Pearson" wrote in message
...
Noemi,

Try something

Set Application.VBE.ActiveVBProject = Workbooks("Book1.xls").VBProject

This will select the Book1.xls project in the VBE. You can't make a
components active if the project is locked. Once you've unlocked the
project, you can make a component active with

Set Application.VBE.ActiveCodePane = _

Workbooks("Book4.xls").VBProject.VBComponents("Fir st").CodeModule.CodePane


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
www.cpearson.com
(email address is on the web site)

"Noemi" wrote in message
...
Hi
I want to create code using the sendkeys( I know they are not very
realiable
but this is all I can do) to remove the project protection off a certain
project however I am not sure how to select the project via sendkeys.

We have multiple hiden sheets which are avilable in VBA but I need to
select
one called First.

Any idea how to do this.

Thanks
Noemi






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
select cells that sum up to a specific value damorrison Excel Discussion (Misc queries) 4 August 17th 06 12:35 PM
select specific records Rob Excel Programming 2 January 18th 06 10:06 PM
select records with a specific value AMK Excel Worksheet Functions 3 June 22nd 05 11:53 AM
Select specific cell Shawn Excel Discussion (Misc queries) 1 April 28th 05 09:00 PM
Problem with invoking project specific Sub in Excel???? Jim Cheng Excel Programming 0 November 19th 03 08:03 PM


All times are GMT +1. The time now is 01:44 PM.

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

About Us

"It's about Microsoft Excel"