2

Two macros I have, one to size down a Word window down to 20% of the RH side of the screen, and the other to 80% on the LH side, have stopped working. (They are for reference files while I work on the other screen).

These are my macros:

Sub RestoreDown()
    Dim myWindow1 As Window, myWindow2 As Window
    Set myWindow1 = ActiveWindow
    With myWindow1
        .WindowState = xlNormal
        .Top = 0
        .Left = (Application.UsableWidth * 0.92) + 1
        .Height = Application.UsableHeight
        .Width = Application.UsableWidth * 0.2
    End With
End Sub
Sub RestoreDown2()
    Dim myWindow1 As Window, myWindow2 As Window
    Set myWindow1 = ActiveWindow
    With myWindow1
        .WindowState = xlNormal
        .Top = 0
        .Left = (Application.UsableWidth * 0.12) + 1
        .Height = Application.UsableHeight
        .Width = Application.UsableWidth * 0.8
    End With
End Sub

They have stopped working. I get the error message 'Object variable or With block variable not set'. I'm not aware of having changed anything.

I should point out that I'm not a technical geek. I use macros a lot for my work (copy-editing of texts) but I'm only at the 'I wish' stage of knowing a lot about VBA. Please kindly bear this in mind when responding!

8
  • What caused them to stop working? If you don't know the actual reason then what was the trigger event? Who wrote these macros?
    – Ramhound
    Mar 7, 2013 at 12:58
  • Both of those run on my system without error. Does this happen in all documents you run them on? Does it only happen after you've run it on another document first? What happens if you close all Word docs and reopen them before running the macro? How about after reboot?
    – CharlieRB
    Mar 7, 2013 at 13:00
  • Ramhound: I'm afraid I don't know what might have triggered this. My Normal.dotm did get corrupted recently, or at least that's what I assume: all my macros seemed to have disappeared. Fortunately I keep a Word file with them all in, so I simply pasted them all back into VBA and they seem to work, except these ones. Mar 7, 2013 at 13:13
  • CharlieRB: My PC closes down every night and I reboot in the morning, so yes, I've rebooted and they still don't work. Mar 7, 2013 at 13:14
  • @sarahwoodton - What caused the corruption. What versions of Windows are you using?
    – Ramhound
    Mar 7, 2013 at 13:32

0

You must log in to answer this question.

Browse other questions tagged .