I am currently working on a project that involves several hidden
workbooks to be open. I have a script that switches these files out
based on a selection. The files have to be closed in order for the
switch to take place since it is copying a background file to become
the actual file. So anyways, I have the script working to close the
workbook, copy, paste, and open the workbook. However, the workbook
always comes up as unhidden. I need to write in to the code that it
needs to hide itself.
My code looks like this (Some code may look familiar because I have had
some help from this group):
HomeFolder = ThisWorkbook.path & "\background\Bus Modules\"
ToFolder = ThisWorkbook.path & "\background\"
Set FromSheet = ActiveSheet
FromRow=3
While FromSheet.Cells(FromRow, 5).Value <> ""
If FromSheet.Cells(FromRow,6) = "x" Then
FromFileName = HomeFolder & FromSheet.Cells(FromRow, 5).Value
ToFileName = ToFolder & "Bus" & ".xls"
Workbooks(FileName).Save
Workbooks(FileName).Saved = True
Workbooks(FileName).Close
FileCopy FromFileName, ToFileName
Workbooks.Open FileName:=ToFileName, UpdateLinks:=0
End If
FromRow = FromRow + 1
Wend
I need the addition to go at the last line of the While Statement to
hide the workbook.
Thank you,
Aaron
Bookmarks