Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default Worksheet Code Name question

Security, Trust access to VB Projects ?

If that's the problem an alternative -

sName = "Sheet2" ' ie codename
For Each ws In ActiveWorkbook.Worksheets
If ws.CodeName = sName Then
sExcelName = ws.Name
Exit For
End If
Next

If Not ws Is Nothing Then
MsgBox ws.Name, , sExcelName
Else
' ??
End If

Perhaps don't need to get sExcelName at all.

Regards,
Peter T

"Barb Reinhardt" wrote in message
...
Bob,

I sent this workbook/presentation combination to someone to test drive and
it didn't resolve this line

sExcelName = XLBook.VBProject.VBComponents(sName).Properties("N ame")

Any idea why?

Barb

"Bob Phillips" wrote:

Barb,

Try this

sExcelName = xlBook.VBProject.VBComponents(sName).Properties("N ame")
Set xlSheet = xlBook.Worksheets(sExcelName)

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Barb Reinhardt" wrote in

message
...
I'm doing some copying and pasting into a PowerPoint presentation and

have
a
problem with the following:

Set XLSheet = XLBook.Sheets(sName)

and I get an error on only one value of sName. I have sName

dimensioned
as
a string. What I want sName to be is the sheet code name, but I think

it's
behaving like the actual sheet name. What do I need to change in

this
code
so that it sees sName as the code name and not the sheetname?

Thanks








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
how to prevent code running when in a worksheet code Corey Excel Programming 5 August 13th 06 08:52 AM
Code Conflicts With Worksheet Change Code Paige Excel Programming 3 March 3rd 06 04:25 PM
Create a newworksheet with VBA code and put VBA code in the new worksheet module ceshelman Excel Programming 4 June 15th 05 04:37 PM
Altering code to reference the worksheet before the active worksheet KimberlyC Excel Programming 8 March 15th 05 10:26 PM
Return to previous worksheet after code pastes in another worksheet? Ron[_28_] Excel Programming 4 September 4th 04 07:52 PM


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