Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 33
Default Worksheet codename

On previously asking for help on renaming the object name
of a worksheet I got the responce(s) below but can't get
either to work, I know the codename property is correct
as I can view the object name in a message box, I just
can't rename it. Can anyone offer me some further help.
Ta
Andy

(This one requires Extensibility library ref)
ThisWorkbook.VBProject.VBComponents.Item
(ActiveSheet.CodeName).Properties("_CodeName").Val ue
= "NewName"

or


ThisWorkbook.VBProject.VBComponents
(ActiveSheet.CodeName).Name = "NewName"
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,824
Default Worksheet codename

Any chance you ran it twice against two different worksheets in the same
workbook?

And if I stepped through this code with F8's, it does the rename of the
codename, but if the codename got renamed (not already NewName), I got a "can't
enter break mode at this time" error message.

Andy wrote:

On previously asking for help on renaming the object name
of a worksheet I got the responce(s) below but can't get
either to work, I know the codename property is correct
as I can view the object name in a message box, I just
can't rename it. Can anyone offer me some further help.
Ta
Andy

(This one requires Extensibility library ref)
ThisWorkbook.VBProject.VBComponents.Item
(ActiveSheet.CodeName).Properties("_CodeName").Val ue
= "NewName"

or

ThisWorkbook.VBProject.VBComponents
(ActiveSheet.CodeName).Name = "NewName"


--

Dave Peterson

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 33
Default Worksheet codename

I am using excel XP and I get the following error:

Run-time error '1004':
Programmactic access to visual basic project is not trusted

I have tried both running from within the sheet object and
as a module, neither work. My code is exactly as below.

Sub Macro1()

ThisWorkbook.VBProject.VBComponents
(ActiveSheet.CodeName).Name = "NewSheet"

End Sub


Thanks in advance
Andy


-----Original Message-----
Andy wrote:
On previously asking for help on renaming the object

name
of a worksheet I got the responce(s) below but can't

get
either to work

Both work for me (Excel 97).
I assume you have the relevant worksheet active?
What error do you get?

Bill Manville
MVP - Microsoft Excel, Oxford, England
No email replies please - reply in newsgroup

.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Worksheet codename

Andy,

You need to enable access to the VBProject. Go to the Tools menu,
choose Macros, then Security. In that dialog, choose the Trusted
Publisher tab and check the "Trust access to Visual Basic
Project".
I

"Andy" wrote in message
...
I am using excel XP and I get the following error:

Run-time error '1004':
Programmactic access to visual basic project is not trusted

I have tried both running from within the sheet object and
as a module, neither work. My code is exactly as below.

Sub Macro1()

ThisWorkbook.VBProject.VBComponents
(ActiveSheet.CodeName).Name = "NewSheet"

End Sub


Thanks in advance
Andy


-----Original Message-----
Andy wrote:
On previously asking for help on renaming the object

name
of a worksheet I got the responce(s) below but can't

get
either to work

Both work for me (Excel 97).
I assume you have the relevant worksheet active?
What error do you get?

Bill Manville
MVP - Microsoft Excel, Oxford, England
No email replies please - reply in newsgroup

.



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Worksheet codename

Ta very much
Works fine now


-----Original Message-----
Andy,

You need to enable access to the VBProject. Go to the

Tools menu,
choose Macros, then Security. In that dialog, choose the

Trusted
Publisher tab and check the "Trust access to Visual Basic
Project".
I

"Andy" wrote in

message
...
I am using excel XP and I get the following error:

Run-time error '1004':
Programmactic access to visual basic project is not

trusted

I have tried both running from within the sheet object

and
as a module, neither work. My code is exactly as below.

Sub Macro1()

ThisWorkbook.VBProject.VBComponents
(ActiveSheet.CodeName).Name = "NewSheet"

End Sub


Thanks in advance
Andy


-----Original Message-----
Andy wrote:
On previously asking for help on renaming the object

name
of a worksheet I got the responce(s) below but can't

get
either to work

Both work for me (Excel 97).
I assume you have the relevant worksheet active?
What error do you get?

Bill Manville
MVP - Microsoft Excel, Oxford, England
No email replies please - reply in newsgroup

.



.

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
string to codename rk0909 Excel Discussion (Misc queries) 4 September 25th 08 10:57 PM
Referencing worksheet CODENAME in a chart object. Bing Excel Discussion (Misc queries) 1 February 15th 05 01:01 AM
How do I determine the Acrobat Distiller codename? Jeremy Gollehon[_2_] Excel Programming 2 October 14th 03 10:13 PM
Attaching a JET database to an Excel Worksheet OR storing large binary data in a worksheet Ant Waters Excel Programming 1 September 3rd 03 11:34 AM
Codename equivalent for Series Sandy V Excel Programming 3 August 25th 03 10:59 PM


All times are GMT +1. The time now is 08:15 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"