-
copying a worksheet that is hidden?
is it possible to copy a worksheet that is hidden into a new workbook? this code is only working if the sheet is Not Hidden.
[vba]
'-----Copy PrintableResults worksheet to new workbook for email submission----
Sub CopyWorksheet()
Dim wb As Workbook, wbName As String
Sheets("PrintableResults").Copy
Set wb = ActiveWorkbook
'save full path as string variable
wbName = ThisWorkbook.Path & "\" & Me.txtVendorName & "1.xls"
'save workbook with that path/name
wb.SaveAs wbName
wb.Close
End Sub[/vba]
-
[vba]
Sub CopyWorksheet()
Dim wb As Workbook, wbName As String
Dim sh As Worksheet
Set sh = Sheets("PrintableResults")
sh.Visible = True
sh.Copy
sh.Visible = xlSheetHidden
Set wb = ActiveWorkbook
'save full path as string variable
wbName = ThisWorkbook.Path & "\" & Me.txtVendorName & "1.xls"
'save workbook with that path/name
wb.SaveAs wbName
wb.Close
End Sub
[/vba]
-
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules