CPGDeveloper
Board Regular
- Joined
- Oct 8, 2008
- Messages
- 190
This is driving me bat-sh*t crazy!
I have a button on a userform that I want to toggle between two open ms word documents. So when I press the button, I want the document that is not active to be the active document on the screen. This is my code:
Private Sub CmdLink_Click()
If CmdLink.Caption = "Link" Then
Windows("UserLink (Read-Only) [Compatibility Mode]").Activate
ActiveWindow.Panes(1).Activate
CmdLink.Caption = "Main"
ElseIf CmdLink.Caption = "Main" Then
Windows("UserMain (Read-Only) [Compatibility Mode]").Activate
ActiveWindow.Panes(1).Activate
CmdLink.Caption = "Link"
End If
End Sub
It changes the caption on the button like it's supposed to, but as far as changing the window -- it does nothing. If I eliminate it down to it's simplest:
Windows("UserLink (Read-Only) [Compatibility Mode]").Activate
ActiveWindow.Panes(1).Activate
It still does nothing. The window doesn't change at all. I'm 150% positive the names of the files are in their correctly. Any ideas on what the problem might be?
I have a button on a userform that I want to toggle between two open ms word documents. So when I press the button, I want the document that is not active to be the active document on the screen. This is my code:
Private Sub CmdLink_Click()
If CmdLink.Caption = "Link" Then
Windows("UserLink (Read-Only) [Compatibility Mode]").Activate
ActiveWindow.Panes(1).Activate
CmdLink.Caption = "Main"
ElseIf CmdLink.Caption = "Main" Then
Windows("UserMain (Read-Only) [Compatibility Mode]").Activate
ActiveWindow.Panes(1).Activate
CmdLink.Caption = "Link"
End If
End Sub
It changes the caption on the button like it's supposed to, but as far as changing the window -- it does nothing. If I eliminate it down to it's simplest:
Windows("UserLink (Read-Only) [Compatibility Mode]").Activate
ActiveWindow.Panes(1).Activate
It still does nothing. The window doesn't change at all. I'm 150% positive the names of the files are in their correctly. Any ideas on what the problem might be?