LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Setting a Worksheets Codename to a variable programmatically

Ok Guys I have a little bit of a problem. I have this line of code:

ActiveWorkbook.VBProject.VBComponents(wsNameold).N ame = "Worksheet1"

and this suprisingly enough changes the workbooks codename to
Worksheet1 based on a variable I define earlier in the code. Now I
want this to set the codename to the value in a cell on the sheet
namely "A1" . I've tried replacing the "Worksheet1" with
Range("A1").value and .text also I've set the value of that range to a
Variable (wsName) which was defined as a string and through that in
there all of which return the error:

"Run-Time error '50132': Application-defined or object-defined error"

Just wondering if I'm trying to do the impossible here or I'm missing
something obvious. Here is the full code in the sub:


Private Sub btnAdd_Click()
Dim wsName As String
Dim wks As Worksheet
Dim wsNameold As String

Let wsNameold = Me.CodeName
Let wsName = Range("a1").Text
Let Me.Name = wsName

ActiveWorkbook.VBProject.VBComponents(wsNameold).N ame =
Range("A1").Value

End Sub

it all works except for the last line. Thanks for your help in advance.

-Turk

 
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
Setting Data Validation Programmatically LoDawg Excel Programming 3 August 25th 06 04:32 AM
Setting Solver Reference-programmatically davidm Excel Programming 2 May 1st 06 01:12 PM
Setting HotKey Programmatically Sprinks Excel Programming 0 December 23rd 05 03:01 PM
WhatsThisHelp in VBA - setting the help file path programmatically seisman Excel Programming 2 July 29th 05 03:06 PM
Setting Printer Options Programmatically Chaplain Doug Excel Programming 0 December 16th 04 09:35 PM


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