open sheet more than once?

O

oldyork90

Do I understand this correctly?

There is one sheet A, so if function one() opens sheet A, then calls
another function two() which also opens sheet A, there shouldn't be a
problem. Right? When two()returns, one() should still have the same
"handle" to the sheet and should still be able to work with it.

But something is up. VBA is losing its brains somewhere. All of a
sudden simple range assignments fail on sheet A, but also on other
sheets. If I try and investigate and expand the sheet expression in
the Locals window, Outlook tries to install! If I just go ahead and
ignore the error (hit continue) everything seems to work just fine.

Again, about instantiating multiple "handles" on a single sheet. That
should be ok? (I'm not 100% that this is causing the problem, but
first things first.)

Thank you

Xcel 2010, xp
 
G

GS

oldyork90 has brought this to us :
Do I understand this correctly?

There is one sheet A, so if function one() opens sheet A, then calls
another function two() which also opens sheet A, there shouldn't be a
problem. Right? When two()returns, one() should still have the same
"handle" to the sheet and should still be able to work with it.

But something is up. VBA is losing its brains somewhere. All of a
sudden simple range assignments fail on sheet A, but also on other
sheets. If I try and investigate and expand the sheet expression in
the Locals window, Outlook tries to install! If I just go ahead and
ignore the error (hit continue) everything seems to work just fine.

Again, about instantiating multiple "handles" on a single sheet. That
should be ok? (I'm not 100% that this is causing the problem, but
first things first.)

Thank you

Xcel 2010, xp

Based on your explanation, *sheets* are located in *workbooks*.
Workbooks are opened, sheets are activated. What you're saying here is
that you are opening sheets when what I think you really mean is you're
opening workbook and trying to reference specific sheets in the open
workbook.

It would be much easier to help you if you post the actual code for
both *one()* and *two()*.

--
Garry

Free usenet access at http://www.eternal-september.org
ClassicVB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion
 
O

oldyork90

GS said:
oldyork90 has brought this to us :
Do I understand this correctly?

There is one sheet A, so if function one() opens sheet A, then calls
another function two() which also opens sheet A, there shouldn't be a
problem. Right? When two()returns, one() should still have the same
"handle" to the sheet and should still be able to work with it.

But something is up. VBA is losing its brains somewhere. All of a
sudden simple range assignments fail on sheet A, but also on other
sheets. If I try and investigate and expand the sheet expression in
the Locals window, Outlook tries to install! If I just go ahead and
ignore the error (hit continue) everything seems to work just fine.

Again, about instantiating multiple "handles" on a single sheet. That
should be ok? (I'm not 100% that this is causing the problem, but
first things first.)

Thank you

Xcel 2010, xp

Based on your explanation, *sheets* are located in *workbooks*.
Workbooks are opened, sheets are activated. What you're saying here is
that you are opening sheets when what I think you really mean is you're
opening workbook and trying to reference specific sheets in the open
workbook.

It would be much easier to help you if you post the actual code for
both *one()* and *two()*.


Thanks Garry. Yes I meant reference when I used handle. I've done
some experimenting and it appears you may use as many references to a
sheet as u want. Something else is going on. I'll pound my head
for awhile. The opening of outlook when trying to explode the sheet
name is really weird.
 
G

GS

oldyork90 wrote :
oldyork90 has brought this to us :
Do I understand this correctly?

There is one sheet A, so if function one() opens sheet A, then calls
another function two() which also opens sheet A, there shouldn't be a
problem. Right? When two()returns, one() should still have the same
"handle" to the sheet and should still be able to work with it.

But something is up. VBA is losing its brains somewhere. All of a
sudden simple range assignments fail on sheet A, but also on other
sheets. If I try and investigate and expand the sheet expression in
the Locals window, Outlook tries to install! If I just go ahead and
ignore the error (hit continue) everything seems to work just fine.

Again, about instantiating multiple "handles" on a single sheet. That
should be ok? (I'm not 100% that this is causing the problem, but
first things first.)

Thank you

Xcel 2010, xp

Based on your explanation, *sheets* are located in *workbooks*.
Workbooks are opened, sheets are activated. What you're saying here is
that you are opening sheets when what I think you really mean is you're
opening workbook and trying to reference specific sheets in the open
workbook.

It would be much easier to help you if you post the actual code for
both *one()* and *two()*.


Thanks Garry. Yes I meant reference when I used handle. I've done
some experimenting and it appears you may use as many references to a
sheet as u want. Something else is going on. I'll pound my head
for awhile. The opening of outlook when trying to explode the sheet
name is really weird.
Free usenet access at http://www.eternal-september.org
ClassicVB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion


Like I said.., show us your code!

--
Garry

Free usenet access at http://www.eternal-september.org
ClassicVB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion
 
I

isabelle

hi,

do you save your files in the format xlXMLSpreadsheet?

http://msdn.microsoft.com/en-us/library/microsoft.office.interop.excel.xlfileformat#Y0


isabelle




Le 2012-10-25 17:59, oldyork90 a écrit :
oldyork90 has brought this to us :
Do I understand this correctly?

There is one sheet A, so if function one() opens sheet A, then calls
another function two() which also opens sheet A, there shouldn't be a
problem. Right? When two()returns, one() should still have the same
"handle" to the sheet and should still be able to work with it.

But something is up. VBA is losing its brains somewhere. All of a
sudden simple range assignments fail on sheet A, but also on other
sheets. If I try and investigate and expand the sheet expression in
the Locals window, Outlook tries to install! If I just go ahead and
ignore the error (hit continue) everything seems to work just fine.

Again, about instantiating multiple "handles" on a single sheet. That
should be ok? (I'm not 100% that this is causing the problem, but
first things first.)

Thank you

Xcel 2010, xp
Based on your explanation, *sheets* are located in *workbooks*.
Workbooks are opened, sheets are activated. What you're saying here is
that you are opening sheets when what I think you really mean is you're
opening workbook and trying to reference specific sheets in the open
workbook.

It would be much easier to help you if you post the actual code for
both *one()* and *two()*.

Thanks Garry. Yes I meant reference when I used handle. I've done
some experimenting and it appears you may use as many references to a
sheet as u want. Something else is going on. I'll pound my head
for awhile. The opening of outlook when trying to explode the sheet
name is really weird.
Free usenet access at http://www.eternal-september.org
ClassicVB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion
 
O

oldyork90

isabelle said:
ps/ it is true that with all these formats, it is easy to get lost !

Went back and removed all selects (mostly from lazy macro pasting) and
problem is solved. Damn. New rule for me - no select. The pasted
macro were so busy that I suspect something there. Anyway, this
seemed the best way to fix this.

The book was saved xlsm.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top