Conernesto
asked on
Method Visible of object '_Worksheet' failed - Excel
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.
<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
is this really a template (extension .xlt) ? or just a normal Excel file .xls, .xlsx extension
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.Applicati on") 'assumes Excel is already open
xl.Visible = true
set wbk = xl.Activeworkbook
wbk.sheets(1).Visible = False 'or True
wbk.sheets("SheetName").vi sible = False 'or True
'do something else here
wbk.SaveAs Filename
wbk.close
set wbk = nothing
xl.Quit
set xl = nothing
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.Applicati
xl.Visible = true
set wbk = xl.Activeworkbook
wbk.sheets(1).Visible = False 'or True
wbk.sheets("SheetName").vi
'do something else here
wbk.SaveAs Filename
wbk.close
set wbk = nothing
xl.Quit
set xl = nothing
ASKER
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....?
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....?
do you know the password to unprotect the workbook?
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,
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,
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Does your code hide/show worksheets at any point? You'll get this error if you don't leave at least one worksheet visible.