stillwillyboy
Technical User
I have two open workbooks. The first is named Outxfer, the other name varies with a pay date that has been entered. i.e. PayDate01-02-03.xls.
On Outxfer I have a button that takes me to the other workbook to preview the pay info before printing. When I go to this other wb, a button is created (named “Return”) and put on the active sheet. This button is so I can return to Outxfer. This part works. But I am having trouble with the code assigned to the newly created “Return” button to get me back to Outxfer.
Below is what I have most recently tried. I put this in my PersonalMacro book also, but still get errors. One is “User-definded type not defined”. There have been others. I know I am close. Thanks.
Sub ReturnToOutxfer()
Dim ReturnButton As CommandButton
Set ReturnButton = ActiveSheet.OLEObjects("Return").Object
With ReturnButton
Windows("OUTXFER.xls").Activate
End With
End Sub
On Outxfer I have a button that takes me to the other workbook to preview the pay info before printing. When I go to this other wb, a button is created (named “Return”) and put on the active sheet. This button is so I can return to Outxfer. This part works. But I am having trouble with the code assigned to the newly created “Return” button to get me back to Outxfer.
Below is what I have most recently tried. I put this in my PersonalMacro book also, but still get errors. One is “User-definded type not defined”. There have been others. I know I am close. Thanks.
Sub ReturnToOutxfer()
Dim ReturnButton As CommandButton
Set ReturnButton = ActiveSheet.OLEObjects("Return").Object
With ReturnButton
Windows("OUTXFER.xls").Activate
End With
End Sub