Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Macro does not work after the program has been restarted in excel.Run time error 2147417848 (80010108) Method visible of object_worksheet failed

I have a serious problem which i can not solve. I have buildt a simple
password login macro in excel making it possible to give different
users different information.

The macro works fine when I made it, however After I save it and
restart it again the above message pops up, when I start the Macro.

the macro I have made look like this,
I seems like the macro crash on this line ( Sheets(i).Visible =
xlSheetVeryHidden)

Private Sub showAll()
Dim i As Integer
For i = 2 To Sheets.Count
Sheets(i).Visible = xlSheetVisible
Next i
End Sub

Private Sub CommandButton1_Click()
Dim vPasswords As Variant
Dim result As String
Dim i, x As Integer
Dim arrLength As Integer


x = 0



vPasswords = Array("OSLO", "Northern Europe", "FERRARI", "Southern
Europe", "HEINEKEN", "Central Europe")
arrLength = UBound(vPasswords) - 1


For i = 2 To Sheets.Count
Sheets(i).Visible = xlSheetVeryHidden
Next i

result = Application.InputBox(prompt:="Enter password", Type:=2,
Title:="Port Report 2005")

If result = "system" Then
For i = 2 To Sheets.Count
Sheets(i).Visible = xlSheetVisible
Next i
Else

Do
If result = "False" Then Exit Sub

For i = LBound(vPasswords) To UBound(vPasswords) Step 2
If vPasswords(i) = result Then
With Sheets(vPasswords(i + 1))
.Visible = True
.Activate
x = x + 1
End With

End If

If i = arrLength Then Exit Do

Next i

Loop While True
If x = 0 Then
MsgBox "You entered wrong password, please try
again, If you miss your password pls contact Knut Espegren"
'Else
'Sheets(2).Visible = xlSheetVisible
End If
End If
End Sub

Private Sub Worksheet_SelectionChange(ByVal Target As Range)

End Sub


I apprecatie any help with this one as it is driving me crazy!

Thank you in advance

Brgds

Knut

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 789
Default Macro does not work after the program has been restarted in excel.Run time error 2147417848 (80010108) Method visible of object_worksheet failed

Hi
Is the workbook protected? If it is, you will have to remove protection
before making the sheets hidden or visible (as you are changing the
workbook).

regards
Paul

wrote:
I have a serious problem which i can not solve. I have buildt a simple
password login macro in excel making it possible to give different
users different information.

The macro works fine when I made it, however After I save it and
restart it again the above message pops up, when I start the Macro.

the macro I have made look like this,
I seems like the macro crash on this line ( Sheets(i).Visible =
xlSheetVeryHidden)
...
Thank you in advance

Brgds

Knut


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Macro does not work after the program has been restarted in excel.Run time error 2147417848 (80010108) Method visible of object_worksheet failed

Hi

The workbook is not protected...
The strange thing is that the macro work the second time you try in the
visual basic modul, without doing any changes.
this does not work in Excel, as excel freezes when you start the macro
in excel.

However I might think that another macro which is running when the
computer is started might interupt the other macro. I use this macro to
hide all sheets exept the frontpage where the login function is
located.
Can this macro play a part?

Sub Auto_open()
Application.Calculation = xlCalculationAutomatic
Sheets("Login").Visible = xlSheetVisible
Sheets("Northern Europe").Visible = xlSheetVeryHidden
Sheets("Central Europe").Visible = xlSheetVeryHidden
Sheets("Country Overview").Visible = xlSheetVeryHidden
Sheets("Sales Site").Visible = xlSheetVeryHidden
Sheets("Sales Port").Visible = xlSheetVeryHidden
Sheets("Logistics_Info").Visible = xlSheetVeryHidden
Sheets("Charts_Overview").Visible = xlSheetVeryHidden
Sheets("Port Sales").Visible = xlSheetVeryHidden
Sheets("Region Overview").Visible = xlSheetVeryHidden
Sheets("Chart per Site").Visible = xlSheetVeryHidden
Sheets("Southern Europe").Visible = xlSheetVeryHidden
Sheets("Area Overview").Visible = xlSheetVeryHidden
Sheets("Area per Country").Visible = xlSheetVeryHidden
Sheets("1").Visible = xlSheetVeryHidden
Sheets("Port Sales").Visible = xlSheetVeryHidden
Sheets("Sales Site Calc").Visible = xlSheetVeryHidden
Sheets("Site Sales").Visible = xlSheetVeryHidden
Sheets("Hierarchy Port").Visible = xlSheetVeryHidden
Sheets("hierarchy Acc").Visible = xlSheetVeryHidden
Sheets("Acc Sales").Visible = xlSheetVeryHidden
Sheets("Input Port Sales").Visible = xlSheetVeryHidden
Sheets("Input Acc Sales").Visible = xlSheetVeryHidden
Sheets("Input Costs").Visible = xlSheetVeryHidden
Sheets("Input Freight_Agent Costs").Visible = xlSheetVeryHidden
Sheets("Input inventory").Visible = xlSheetVeryHidden
Sheets("Input HR").Visible = xlSheetVeryHidden
Sheets("IDC").Visible = xlSheetVeryHidden
Sheets("Login").Select
MsgBox ("Welcome to the Port Report 2005, Login by typing the
Password for you Area, it is important that you it in Capitol letters,
if any errors contact Knut Espegren")
End Sub

Thank you again for your support!

Knut

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Macro does not work after the program has been restarted in excel.Run time error 2147417848 (80010108) Method visible of object_worksheet failed

Your autoopen macro should be completed when the user is presented the
msgbox and clicks OK.

--
Regards,
Tom Ogilvy




"ymze" wrote in message
ups.com...
Hi

The workbook is not protected...
The strange thing is that the macro work the second time you try in the
visual basic modul, without doing any changes.
this does not work in Excel, as excel freezes when you start the macro
in excel.

However I might think that another macro which is running when the
computer is started might interupt the other macro. I use this macro to
hide all sheets exept the frontpage where the login function is
located.
Can this macro play a part?

Sub Auto_open()
Application.Calculation = xlCalculationAutomatic
Sheets("Login").Visible = xlSheetVisible
Sheets("Northern Europe").Visible = xlSheetVeryHidden
Sheets("Central Europe").Visible = xlSheetVeryHidden
Sheets("Country Overview").Visible = xlSheetVeryHidden
Sheets("Sales Site").Visible = xlSheetVeryHidden
Sheets("Sales Port").Visible = xlSheetVeryHidden
Sheets("Logistics_Info").Visible = xlSheetVeryHidden
Sheets("Charts_Overview").Visible = xlSheetVeryHidden
Sheets("Port Sales").Visible = xlSheetVeryHidden
Sheets("Region Overview").Visible = xlSheetVeryHidden
Sheets("Chart per Site").Visible = xlSheetVeryHidden
Sheets("Southern Europe").Visible = xlSheetVeryHidden
Sheets("Area Overview").Visible = xlSheetVeryHidden
Sheets("Area per Country").Visible = xlSheetVeryHidden
Sheets("1").Visible = xlSheetVeryHidden
Sheets("Port Sales").Visible = xlSheetVeryHidden
Sheets("Sales Site Calc").Visible = xlSheetVeryHidden
Sheets("Site Sales").Visible = xlSheetVeryHidden
Sheets("Hierarchy Port").Visible = xlSheetVeryHidden
Sheets("hierarchy Acc").Visible = xlSheetVeryHidden
Sheets("Acc Sales").Visible = xlSheetVeryHidden
Sheets("Input Port Sales").Visible = xlSheetVeryHidden
Sheets("Input Acc Sales").Visible = xlSheetVeryHidden
Sheets("Input Costs").Visible = xlSheetVeryHidden
Sheets("Input Freight_Agent Costs").Visible = xlSheetVeryHidden
Sheets("Input inventory").Visible = xlSheetVeryHidden
Sheets("Input HR").Visible = xlSheetVeryHidden
Sheets("IDC").Visible = xlSheetVeryHidden
Sheets("Login").Select
MsgBox ("Welcome to the Port Report 2005, Login by typing the
Password for you Area, it is important that you it in Capitol letters,
if any errors contact Knut Espegren")
End Sub

Thank you again for your support!

Knut



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Macro does not work after the program has been restarted in excel.Run time error 2147417848 (80010108) Method visible of object_worksheet failed

ok, thanks. However it doesnt solve the problem:)

Do anyone have any ideas?



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Macro does not work after the program has been restarted inexcel.Run time error 2147417848 (80010108) Method visible ofobject_worksheet failed

Is that code in a General module--or is it in ThisWorkbook or one of the sheet
modules?

ymze wrote:

ok, thanks. However it doesnt solve the problem:)

Do anyone have any ideas?


--

Dave Peterson
  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Macro does not work after the program has been restarted in excel.Run time error 2147417848 (80010108) Method visible of object_worksheet failed

The first code, part 1, (the login function) is part of sheet 1 while
the rest of the code in the workbook is code in the general module.

  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Macro does not work after the program has been restarted inexcel.Run time error 2147417848 (80010108) Method visible ofobject_worksheet failed

auto_open should be in a general module.

ymze wrote:

The first code, part 1, (the login function) is part of sheet 1 while
the rest of the code in the workbook is code in the general module.


--

Dave Peterson
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
Automation error '-2147417848 (80010108)' excel 2007 Lilandra Excel Discussion (Misc queries) 0 July 9th 09 11:16 PM
Error: method 'select' of object_worksheet' failed Carl Excel Discussion (Misc queries) 4 September 9th 06 08:52 PM
Method 'Range' of Object_Worksheet Failed Excel-erate2004[_21_] Excel Programming 23 September 2nd 04 05:49 AM
Excel Bug: Run-time error '-2147417848 (80010108)' majikman[_18_] Excel Programming 1 May 13th 04 08:16 PM
Run time error 2147417848(80010108) Praveen Excel Programming 4 December 18th 03 10:23 AM


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