Consulting

Results 1 to 7 of 7

Thread: Excel Page Format-help pls.

  1. #1
    VBAX Newbie
    Joined
    Sep 2012
    Posts
    4
    Location

    Excel Page Format-help pls.

    Hello everyone,
    I have a workbook called "render" with sheet1 named "return" and when I open "return" sheet I would like the following format to be applied to the whole page.

    Private Sub Workbook_Activate()

    On Error Resume Next
    With Application
    .DisplayFullScreen = True
    .CommandBars("Worksheet Menu Bar").Enabled = False
    Application.ActiveWindow.DisplayGridlines = False
    ActiveWindow.DisplayHeadings = False
    ActiveWindow.DisplayHorizontalScrollBar = False
    ActiveWindow.DisplayVerticalScrollBar = False
    ActiveWindow.DisplayWorkbookTabs = False
    Range("A1").Select

    End With

    End Sub

    The good thing is that it does that, it removes the grid, bars and so on, but unfortunately this format applies to every single excel page in my computer. How do I limit my code to only current workbook called "render" and applied only to the sheet1 called "return".
    Thank you for your help, angela.

    pls don't laugh, i'm just a hopeless starter.
    Last edited by Angela; 09-19-2012 at 08:28 AM.

  2. #2
    VBAX Guru mancubus's Avatar
    Joined
    Dec 2010
    Location
    "Where I lay my head is home" :D
    Posts
    2,644
    hi. wellcome to the forum.

    goes to ThisWorkbook code module of render.xlsm or render.xls:

    [vba]
    Private Sub Workbook_SheetActivate(ByVal Sh As Object)

    If UCase(Sh.Name) <> UCase("return") Then Exit Sub

    On Error Resume Next

    Application.DisplayFullScreen = True
    Application.CommandBars("Worksheet Menu Bar").Enabled = False
    ActiveWindow.DisplayGridlines = False
    ActiveWindow.DisplayHeadings = False
    ActiveWindow.DisplayHorizontalScrollBar = False
    ActiveWindow.DisplayVerticalScrollBar = False
    ActiveWindow.DisplayWorkbookTabs = False
    Range("A1").Select

    End Sub



    Private Sub Workbook_SheetDeactivate(ByVal Sh As Object)

    If UCase(Sh.Name) <> UCase("return") Then Exit Sub

    On Error Resume Next

    Application.DisplayFullScreen = False
    Application.CommandBars("Worksheet Menu Bar").Enabled = True
    ActiveWindow.DisplayGridlines = True
    ActiveWindow.DisplayHeadings = True
    ActiveWindow.DisplayHorizontalScrollBar = True
    ActiveWindow.DisplayVerticalScrollBar = True
    ActiveWindow.DisplayWorkbookTabs = True
    Range("A1").Select

    End Sub
    [/vba]
    PLS DO NOT PM; OPEN A THREAD INSTEAD!!!

    1) Posting Code
    [CODE]PasteYourCodeHere[/CODE]
    (or paste your code, select it, click # button)

    2) Uploading File(s)
    Go Advanced / Attachments - Manage Attachments / Add Files / Select Files / Select the file(s) (multiple files can be selected while holding Ctrl key) / Upload Files / Done
    Replace company specific / sensitive / confidential data. Include so many rows and sheets etc in the uploaded workbook to enable the helpers visualize the data and table structure. Helpers do not need the entire workbook.

    3) Testing the Codes
    always back up your files before testing the codes.

    4) Marking the Thread as Solved
    from Thread Tools (on the top right corner, above the first message)

  3. #3
    VBAX Newbie
    Joined
    Sep 2012
    Posts
    4
    Location
    Thank you so much.

  4. #4
    VBAX Guru mancubus's Avatar
    Joined
    Dec 2010
    Location
    "Where I lay my head is home" :D
    Posts
    2,644
    you're most wellcome.
    PLS DO NOT PM; OPEN A THREAD INSTEAD!!!

    1) Posting Code
    [CODE]PasteYourCodeHere[/CODE]
    (or paste your code, select it, click # button)

    2) Uploading File(s)
    Go Advanced / Attachments - Manage Attachments / Add Files / Select Files / Select the file(s) (multiple files can be selected while holding Ctrl key) / Upload Files / Done
    Replace company specific / sensitive / confidential data. Include so many rows and sheets etc in the uploaded workbook to enable the helpers visualize the data and table structure. Helpers do not need the entire workbook.

    3) Testing the Codes
    always back up your files before testing the codes.

    4) Marking the Thread as Solved
    from Thread Tools (on the top right corner, above the first message)

  5. #5
    VBAX Newbie
    Joined
    Sep 2012
    Posts
    4
    Location
    Please check this out. Inside the workbook all the sheets opens without being adjusted to the code, but if I close the workbook from the sheet "return" and I try to open any other excel workbook, it will take the new format, in other words they are being ajusted to the code again, but not all of it. Hmm..why is this happening?. To be more specific in here, when I open another workbook the Worksheet Menu Bar does not get Enabled, all the rest gets enabled.
    Last edited by Angela; 09-19-2012 at 01:43 PM.

  6. #6
    VBAX Guru mancubus's Avatar
    Joined
    Dec 2010
    Location
    "Where I lay my head is home" :D
    Posts
    2,644
    you may select another sheet by hitting ctrl+pgup or pgdn, then close the workbook.

    or add below to ThisWorkbook:

    [VBA]
    Private Sub Workbook_Deactivate()

    On Error Resume Next

    Application.DisplayFullScreen = False
    Application.CommandBars("Worksheet Menu Bar").Enabled = True
    ActiveWindow.DisplayGridlines = True
    ActiveWindow.DisplayHeadings = True
    ActiveWindow.DisplayHorizontalScrollBar = True
    ActiveWindow.DisplayVerticalScrollBar = True
    ActiveWindow.DisplayWorkbookTabs = True

    End Sub
    [/VBA]
    PLS DO NOT PM; OPEN A THREAD INSTEAD!!!

    1) Posting Code
    [CODE]PasteYourCodeHere[/CODE]
    (or paste your code, select it, click # button)

    2) Uploading File(s)
    Go Advanced / Attachments - Manage Attachments / Add Files / Select Files / Select the file(s) (multiple files can be selected while holding Ctrl key) / Upload Files / Done
    Replace company specific / sensitive / confidential data. Include so many rows and sheets etc in the uploaded workbook to enable the helpers visualize the data and table structure. Helpers do not need the entire workbook.

    3) Testing the Codes
    always back up your files before testing the codes.

    4) Marking the Thread as Solved
    from Thread Tools (on the top right corner, above the first message)

  7. #7
    VBAX Newbie
    Joined
    Sep 2012
    Posts
    4
    Location
    Thank you, now it's working independently.

Posting Permissions

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