I have successfully coded a routine to copy a sheet to a txt file, allowing it to be used as input by other workbooks not in the same collection. Everything works fine when I do not keep the sheet hidden, but fails when it is hidden. So, I have surrounded the copy command with Visible=True and Visible=False instructions. This fails on the Visible=False command. Can anyone help me with this?
Code
Application.ScreenUpdating = False
strCubeAccountName = strFilePath & wsControl.Range("E7") & ".txt"
On Error Resume Next
Kill strCubeAccountName
On Error GoTo 0
Worksheets("CubeArray").Visible = True
wsCubeArray.Copy
[COLOR=#ff0000] Worksheets("CubeArray").Visible = False[/COLOR]
ActiveWorkbook.SaveAs Filename:=strCubeAccountName, FileFormat:=xlCSV, CreateBackup:=False
ActiveWorkbook.Close Savechanges:=False
Application.ScreenUpdating = True
Display More