+ Reply to Thread
Results 1 to 2 of 2

hide a workbook with macro

  1. #1
    txaggies07@gmail.com
    Guest

    hide a workbook with macro

    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


  2. #2
    Bob Phillips
    Guest

    Re: hide a workbook with macro

    Try adding

    activewindow.Visible=true

    after the workbook open.

    --
    HTH

    Bob Phillips

    (replace somewhere in email address with gmail if mailing direct)

    <txaggies07@gmail.com> wrote in message
    news:1155049500.405690.31290@i42g2000cwa.googlegroups.com...
    > 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
    >




+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1