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

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



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 129
Default Worksheet Code Name question

Set XLSheet = XLBook.Sheets(sName) .codename

Barb Reinhardt wrote:
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


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,355
Default Worksheet Code Name question

That's not working either. Any other suggestions?

" wrote:

Set XLSheet = XLBook.Sheets(sName) .codename

Barb Reinhardt wrote:
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



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,355
Default Worksheet Code Name question

I'm not clear on how this will help me. I'm not using Sheet1.name. I want
sname to be the what you show as Sheet1.name.

"Don Guillett" wrote:

MsgBox Sheets(Sheet1.Name).Range("a1")

--
Don Guillett
SalesAid Software

"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








  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Worksheet Code Name question

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





  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,355
Default Worksheet Code Name question

How would I dimension sExcelName?

"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






  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Worksheet Code Name question

s for String <g

--
HTH

Bob Phillips

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

"Barb Reinhardt" wrote in message
...
How would I dimension sExcelName?

"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








  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,355
Default Worksheet Code Name question

Got it to work. Thanks so much!

"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






  #10   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,355
Default Worksheet Code Name question

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








  #11   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Worksheet Code Name question

Barb,

can you send it to me?

--
HTH

Bob Phillips

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

"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








  #12   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,355
Default Worksheet Code Name question

If I could I would. It's got proprietary info in it. Any other suggestions?

"Bob Phillips" wrote:

Barb,

can you send it to me?

--
HTH

Bob Phillips

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

"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









  #13   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Worksheet Code Name question

Can you not take out the confidential stuff?

--
HTH

Bob Phillips

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

"Barb Reinhardt" wrote in message
...
If I could I would. It's got proprietary info in it. Any other

suggestions?

"Bob Phillips" wrote:

Barb,

can you send it to me?

--
HTH

Bob Phillips

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

"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











  #14   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 04:08 AM.

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"