ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Unhiding a sheet (https://www.excelbanter.com/excel-programming/304711-unhiding-sheet.html)

Gerry Abbott

Unhiding a sheet
 
Hi all,
Im using some code from another application (access) to populate a range
with data, and save the sheet. However when I save it and open it, the sheet
i've worked on is Hidden. I can unhide this manually, and all else is in
order.

I used the sheet.visible property before saving but this does not work.

Any advice welcome.


Gerry Abbott


Code:
-------------------------------------------------------------
Private Sub Command2_Click()

Dim myWb As Workbook
Dim mySh As Worksheet
Dim i As Integer

Set myWb = GetObject("My file........")
Set mySh = myWb.Worksheets("ResCare")

For i = 1 To 10
mySh.Range("A" & i).Value = i * 10
Next i

myWb.Worksheets(1).Visible = xlSheetVisible
myWb.Save

Set mySh = Nothing
Set myWb = Nothing

End Sub
-------------------------------------------------------------





Frank Kabel

Unhiding a sheet
 
Hio
what is the exact code you have used which does not work
with a hidden sheet)?

-----Original Message-----
Hi all,
Im using some code from another application (access) to

populate a range
with data, and save the sheet. However when I save it and

open it, the sheet
i've worked on is Hidden. I can unhide this manually, and

all else is in
order.

I used the sheet.visible property before saving but this

does not work.

Any advice welcome.


Gerry Abbott


Code:
----------------------------------------------------------

---
Private Sub Command2_Click()

Dim myWb As Workbook
Dim mySh As Worksheet
Dim i As Integer

Set myWb = GetObject("My file........")
Set mySh = myWb.Worksheets("ResCare")

For i = 1 To 10
mySh.Range("A" & i).Value = i * 10
Next i

myWb.Worksheets(1).Visible = xlSheetVisible
myWb.Save

Set mySh = Nothing
Set myWb = Nothing

End Sub
----------------------------------------------------------

---




.


Tom Ogilvy

Unhiding a sheet
 
Is it the sheet or the workbook that is hidden?

if the sheet, make sure you make the sheet visible before you save the
workbook. (in your code)

If it is the workbook, make sure you make the workbook visible before you
save it. (in your code)

--
Regards,
Tom Ogilvy

"Gerry Abbott" wrote in message
...
Hi all,
Im using some code from another application (access) to populate a range
with data, and save the sheet. However when I save it and open it, the

sheet
i've worked on is Hidden. I can unhide this manually, and all else is in
order.

I used the sheet.visible property before saving but this does not work.

Any advice welcome.


Gerry Abbott


Code:
-------------------------------------------------------------
Private Sub Command2_Click()

Dim myWb As Workbook
Dim mySh As Worksheet
Dim i As Integer

Set myWb = GetObject("My file........")
Set mySh = myWb.Worksheets("ResCare")

For i = 1 To 10
mySh.Range("A" & i).Value = i * 10
Next i

myWb.Worksheets(1).Visible = xlSheetVisible
myWb.Save

Set mySh = Nothing
Set myWb = Nothing

End Sub
-------------------------------------------------------------







Gerry Abbott

Unhiding a sheet
 
See below

"Frank Kabel" wrote in message
...
Hio
what is the exact code you have used which does not work
with a hidden sheet)?

-----Original Message-----
Hi all,
Im using some code from another application (access) to

populate a range
with data, and save the sheet. However when I save it and

open it, the sheet
i've worked on is Hidden. I can unhide this manually, and

all else is in
order.

I used the sheet.visible property before saving but this

does not work.

Any advice welcome.


Gerry Abbott


Code:
----------------------------------------------------------

---
Private Sub Command2_Click()

Dim myWb As Workbook
Dim mySh As Worksheet
Dim i As Integer

Set myWb = GetObject("My file........")
Set mySh = myWb.Worksheets("ResCare")

For i = 1 To 10
mySh.Range("A" & i).Value = i * 10
Next i

myWb.Worksheets(1).Visible = xlSheetVisible
myWb.Save

Set mySh = Nothing
Set myWb = Nothing

End Sub
----------------------------------------------------------

---




.




Gerry Abbott

Unhiding a sheet
 
Thanks tom,
Yes it is the workbook which is hidden,
but I cannot find any workbook property to unhide it.

see code below





"Tom Ogilvy" wrote in message
...
Is it the sheet or the workbook that is hidden?

if the sheet, make sure you make the sheet visible before you save the
workbook. (in your code)

If it is the workbook, make sure you make the workbook visible before you
save it. (in your code)

--
Regards,
Tom Ogilvy

"Gerry Abbott" wrote in message
...
Hi all,
Im using some code from another application (access) to populate a range
with data, and save the sheet. However when I save it and open it, the

sheet
i've worked on is Hidden. I can unhide this manually, and all else is in
order.

I used the sheet.visible property before saving but this does not work.

Any advice welcome.


Gerry Abbott


Code:
-------------------------------------------------------------
Private Sub Command2_Click()

Dim myWb As Workbook
Dim mySh As Worksheet
Dim i As Integer

Set myWb = GetObject("My file........")
Set mySh = myWb.Worksheets("ResCare")

For i = 1 To 10
mySh.Range("A" & i).Value = i * 10
Next i

myWb.Worksheets(1).Visible = xlSheetVisible
myWb.Save

Set mySh = Nothing
Set myWb = Nothing

End Sub
-------------------------------------------------------------









Gerry Abbott

Unhiding a sheet
 
There is no macro code running, or associated with the file.

"Newbie" wrote in message
...
check the worksheet_open and worksheet_beforeclose for code that will set

visible back to false.

"Gerry Abbott" wrote:

Hi all,
Im using some code from another application (access) to populate a range
with data, and save the sheet. However when I save it and open it, the

sheet
i've worked on is Hidden. I can unhide this manually, and all else is in
order.

I used the sheet.visible property before saving but this does not work.

Any advice welcome.


Gerry Abbott


Code:
-------------------------------------------------------------
Private Sub Command2_Click()

Dim myWb As Workbook
Dim mySh As Worksheet
Dim i As Integer

Set myWb = GetObject("My file........")
Set mySh = myWb.Worksheets("ResCare")

For i = 1 To 10
mySh.Range("A" & i).Value = i * 10
Next i

myWb.Worksheets(1).Visible = xlSheetVisible
myWb.Save

Set mySh = Nothing
Set myWb = Nothing

End Sub
-------------------------------------------------------------








Frank Kabel

Unhiding a sheet
 
Hi
try replacing
myWb.Worksheets(1).Visible = xlSheetVisible

with
myWb.Worksheets(1).Visible = -1

--
Regards
Frank Kabel
Frankfurt, Germany

"Gerry Abbott" schrieb im Newsbeitrag
...
See below

"Frank Kabel" wrote in message
...
Hio
what is the exact code you have used which does not work
with a hidden sheet)?

-----Original Message-----
Hi all,
Im using some code from another application (access) to

populate a range
with data, and save the sheet. However when I save it and

open it, the sheet
i've worked on is Hidden. I can unhide this manually, and

all else is in
order.

I used the sheet.visible property before saving but this

does not work.

Any advice welcome.


Gerry Abbott


Code:
----------------------------------------------------------

---
Private Sub Command2_Click()

Dim myWb As Workbook
Dim mySh As Worksheet
Dim i As Integer

Set myWb = GetObject("My file........")
Set mySh = myWb.Worksheets("ResCare")

For i = 1 To 10
mySh.Range("A" & i).Value = i * 10
Next i

myWb.Worksheets(1).Visible = xlSheetVisible
myWb.Save

Set mySh = Nothing
Set myWb = Nothing

End Sub
----------------------------------------------------------

---




.





Tom Ogilvy

Unhiding a sheet
 
workbooks.visible = True

However, when you open the workbook with automation, it is the application
which is hidden.

xlApp.visible = True
xlapp.Workbooks(1).Visible = True ' just to be sure

now save the worbkook.

--
Regards,
Tom Ogilvy

"Gerry Abbott" wrote in message
...
Thanks tom,
Yes it is the workbook which is hidden,
but I cannot find any workbook property to unhide it.

see code below





"Tom Ogilvy" wrote in message
...
Is it the sheet or the workbook that is hidden?

if the sheet, make sure you make the sheet visible before you save the
workbook. (in your code)

If it is the workbook, make sure you make the workbook visible before

you
save it. (in your code)

--
Regards,
Tom Ogilvy

"Gerry Abbott" wrote in message
...
Hi all,
Im using some code from another application (access) to populate a

range
with data, and save the sheet. However when I save it and open it, the

sheet
i've worked on is Hidden. I can unhide this manually, and all else is

in
order.

I used the sheet.visible property before saving but this does not

work.

Any advice welcome.


Gerry Abbott


Code:
-------------------------------------------------------------
Private Sub Command2_Click()

Dim myWb As Workbook
Dim mySh As Worksheet
Dim i As Integer

Set myWb = GetObject("My file........")
Set mySh = myWb.Worksheets("ResCare")

For i = 1 To 10
mySh.Range("A" & i).Value = i * 10
Next i

myWb.Worksheets(1).Visible = xlSheetVisible
myWb.Save

Set mySh = Nothing
Set myWb = Nothing

End Sub
-------------------------------------------------------------











Tom Ogilvy

Unhiding a sheet
 
Disregard the sample code (too many errors). See these articles.

http://support.microsoft.com/default...32&Product=xlw
XL97: Workbook Created via Automation Opens as Hidden

http://support.microsoft.com/default...63&Product=xlw
XL2000: Workbook Created with Automation Is Hidden When Opened

--
Regards,
Tom Ogilvy


"Tom Ogilvy" wrote in message
...
workbooks.visible = True

However, when you open the workbook with automation, it is the application
which is hidden.

xlApp.visible = True
xlapp.Workbooks(1).Visible = True ' just to be sure

now save the worbkook.

--
Regards,
Tom Ogilvy

"Gerry Abbott" wrote in message
...
Thanks tom,
Yes it is the workbook which is hidden,
but I cannot find any workbook property to unhide it.

see code below





"Tom Ogilvy" wrote in message
...
Is it the sheet or the workbook that is hidden?

if the sheet, make sure you make the sheet visible before you save the
workbook. (in your code)

If it is the workbook, make sure you make the workbook visible before

you
save it. (in your code)

--
Regards,
Tom Ogilvy

"Gerry Abbott" wrote in message
...
Hi all,
Im using some code from another application (access) to populate a

range
with data, and save the sheet. However when I save it and open it,

the
sheet
i've worked on is Hidden. I can unhide this manually, and all else

is
in
order.

I used the sheet.visible property before saving but this does not

work.

Any advice welcome.


Gerry Abbott


Code:
-------------------------------------------------------------
Private Sub Command2_Click()

Dim myWb As Workbook
Dim mySh As Worksheet
Dim i As Integer

Set myWb = GetObject("My file........")
Set mySh = myWb.Worksheets("ResCare")

For i = 1 To 10
mySh.Range("A" & i).Value = i * 10
Next i

myWb.Worksheets(1).Visible = xlSheetVisible
myWb.Save

Set mySh = Nothing
Set myWb = Nothing

End Sub
-------------------------------------------------------------













Gerry Abbott

Unhiding a sheet
 
Many thanks Tom,
The KB reference hit the mark.

Would love to know how you found them.

Gerry Abbott


"Tom Ogilvy" wrote in message
...
Disregard the sample code (too many errors). See these articles.

http://support.microsoft.com/default...32&Product=xlw
XL97: Workbook Created via Automation Opens as Hidden

http://support.microsoft.com/default...63&Product=xlw
XL2000: Workbook Created with Automation Is Hidden When Opened

--
Regards,
Tom Ogilvy


"Tom Ogilvy" wrote in message
...
workbooks.visible = True

However, when you open the workbook with automation, it is the

application
which is hidden.

xlApp.visible = True
xlapp.Workbooks(1).Visible = True ' just to be sure

now save the worbkook.

--
Regards,
Tom Ogilvy

"Gerry Abbott" wrote in message
...
Thanks tom,
Yes it is the workbook which is hidden,
but I cannot find any workbook property to unhide it.

see code below





"Tom Ogilvy" wrote in message
...
Is it the sheet or the workbook that is hidden?

if the sheet, make sure you make the sheet visible before you save

the
workbook. (in your code)

If it is the workbook, make sure you make the workbook visible

before
you
save it. (in your code)

--
Regards,
Tom Ogilvy

"Gerry Abbott" wrote in message
...
Hi all,
Im using some code from another application (access) to populate a

range
with data, and save the sheet. However when I save it and open it,

the
sheet
i've worked on is Hidden. I can unhide this manually, and all else

is
in
order.

I used the sheet.visible property before saving but this does not

work.

Any advice welcome.


Gerry Abbott


Code:
-------------------------------------------------------------
Private Sub Command2_Click()

Dim myWb As Workbook
Dim mySh As Worksheet
Dim i As Integer

Set myWb = GetObject("My file........")
Set mySh = myWb.Worksheets("ResCare")

For i = 1 To 10
mySh.Range("A" & i).Value = i * 10
Next i

myWb.Worksheets(1).Visible = xlSheetVisible
myWb.Save

Set mySh = Nothing
Set myWb = Nothing

End Sub
-------------------------------------------------------------















Tom Ogilvy

Unhiding a sheet
 
It was hard, but I knew they were there (having seen them before), so
persistance paid of. I forget the exact search terms I used. Sorry.

--
Regards,
Tom Ogilvy

"Gerry Abbott" wrote in message
...
Many thanks Tom,
The KB reference hit the mark.

Would love to know how you found them.

Gerry Abbott


"Tom Ogilvy" wrote in message
...
Disregard the sample code (too many errors). See these articles.


http://support.microsoft.com/default...32&Product=xlw
XL97: Workbook Created via Automation Opens as Hidden


http://support.microsoft.com/default...63&Product=xlw
XL2000: Workbook Created with Automation Is Hidden When Opened

--
Regards,
Tom Ogilvy


"Tom Ogilvy" wrote in message
...
workbooks.visible = True

However, when you open the workbook with automation, it is the

application
which is hidden.

xlApp.visible = True
xlapp.Workbooks(1).Visible = True ' just to be sure

now save the worbkook.

--
Regards,
Tom Ogilvy

"Gerry Abbott" wrote in message
...
Thanks tom,
Yes it is the workbook which is hidden,
but I cannot find any workbook property to unhide it.

see code below





"Tom Ogilvy" wrote in message
...
Is it the sheet or the workbook that is hidden?

if the sheet, make sure you make the sheet visible before you save

the
workbook. (in your code)

If it is the workbook, make sure you make the workbook visible

before
you
save it. (in your code)

--
Regards,
Tom Ogilvy

"Gerry Abbott" wrote in message
...
Hi all,
Im using some code from another application (access) to populate

a
range
with data, and save the sheet. However when I save it and open

it,
the
sheet
i've worked on is Hidden. I can unhide this manually, and all

else
is
in
order.

I used the sheet.visible property before saving but this does

not
work.

Any advice welcome.


Gerry Abbott


Code:
-------------------------------------------------------------
Private Sub Command2_Click()

Dim myWb As Workbook
Dim mySh As Worksheet
Dim i As Integer

Set myWb = GetObject("My file........")
Set mySh = myWb.Worksheets("ResCare")

For i = 1 To 10
mySh.Range("A" & i).Value = i * 10
Next i

myWb.Worksheets(1).Visible = xlSheetVisible
myWb.Save

Set mySh = Nothing
Set myWb = Nothing

End Sub
-------------------------------------------------------------


















All times are GMT +1. The time now is 11:45 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com