[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Method Visible of object '_Worksheet' failed - Excel

Posted on 2013-11-05
7
Medium Priority
?
2,809 Views
Last Modified: 2013-11-08
I am running some code to open an Excel template and save it with a different name. I get the obove message when I run the code. I don't know what is cousing this. From Access, the Excel template is opened and I get the Title message.
0
Comment
Question by:Conernesto
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 61

Expert Comment

by:mbizup
ID: 39624537
Hard to say without actually seeing your code.

Does your code hide/show worksheets at any point?  You'll get this error if you don't leave at least one worksheet visible.
0
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 39624557
<I am running some code to open an Excel template>

is this really a template (extension .xlt) ?  or just a normal Excel file .xls, .xlsx extension
0
 
LVL 48

Expert Comment

by:Dale Fye
ID: 39624626
agree with miriam.

Are you really trying to hide/unhide worksheets, or are you trying to make Excel visible, so that you can see the template workbook?

I usually do something like:

Dim xl as Object  'Excel.Application if you want intellisense
Dim wbk as Object
Dim sht as Object

set xl = GetObject("Excel.Application") 'assumes Excel is already open
xl.Visible = true

set wbk = xl.Activeworkbook
wbk.sheets(1).Visible = False 'or True
wbk.sheets("SheetName").visible = False  'or True

'do something else here

wbk.SaveAs Filename
wbk.close
set wbk = nothing
xl.Quit
set xl = nothing
0
Learn Veeam advantages over legacy backup

Every day, more and more legacy backup customers switch to Veeam. Technologies designed for the client-server era cannot restore any IT service running in the hybrid cloud within seconds. Learn top Veeam advantages over legacy backup and get Veeam for the price of your renewal

 

Author Comment

by:Conernesto
ID: 39624976
I think that my problem has to do with protection. I have various sheets within my workbook. My worksheet is saved as an older version of Excel *.xls.  When I open my worksheet and go to File Info Under Permissions it states "The structure of the worksheet has been locked to prevent unwanted changes, such as moving, deleting, or adding sheets.

I need the Permissions to say "Anyone can open, copy, and change any part of this workbook."

How do I change permissions to Anyone can open....?
0
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 39625006
do you know the password to unprotect the workbook?
0
 
LVL 61

Expert Comment

by:mbizup
ID: 39625012
This shows how to unlock an Excel 2003 spreadsheet:

http://www.ehow.com/how_6395137_unlock-excel-2003-spreadsheet.html

You might need a password (we can't help with breaking password protection, of course)

Also take a look at this, about unlocking specific portions:
http://office.microsoft.com/en-us/excel-help/lock-or-unlock-specific-areas-of-a-protected-worksheet-HA010096837.aspx

The interface may differ depending on your Excel version,
0
 
LVL 120

Accepted Solution

by:
Rey Obrero (Capricorn1) earned 2000 total points
ID: 39625036
here's how to unlock the excel in vba

Sub UnlockXL()
Dim xlObj As Object, xlPath As String
Dim wkbpwd As String, shtpwd As String
wkbpwd = "<pwd for workbook>"
shtpwd = "<pwd for sheet>"
xlPath = CurrentProject.Path & "\ExcelFile.xls"
Set xlObj = CreateObject("excel.application")
    xlObj.workbooks.Open xlPath
    With xlObj
        .Worksheets("NameOfSheet").Activate
        .Worksheets("NameOfsheet").unprotect shtpwd
        .range("A2").select
        .activeworkbook.unprotect wkbpwd
        .activeworkbook.Save
    End With
    xlObj.Quit
    Set xlObj = Nothing

End Sub
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Access custom database properties are useful for storing miscellaneous bits of information in a format that persists through database closing and reopening.  This article shows how to create and use them.
Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question