Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 34
Default Toggle Between 2 Windows

Hello,
I have a separate working file that I'd like to paste into a finalized
budget file. I think a macro would work great but my macro records the
specific file name whereas I'd rather have the paste-to file name be
based on whatever file is currently opened within the Window. I'll just
toggle to the finalized file that's already opened and do a paste. I'll
ensure that there will only be 2 files opened before activating this
macro. Could somebody please help me with this? Also, what's the code
for ending a macro simply by clicking on the corner "X" in the
messagebox?

Dim curWks As Worksheet
Set curWks = ActiveSheet

'msgbox ({name of the current file} will be pasted to {other window's
file name}, _
vbYesNo, "Move Information")
If vbYes Then
'if paste-to file doesn't contain a Secondary Budget tab, then msgbox _
({other window's file name} doesn't contain a Secondary Budget
tab. Paste _
can not be done). exit sub

curWks.Activate
Cells.Select
Selection.Copy
Windows("Budget 2007.xls").Activate
Sheets("Secondary Budget").Visible = True
Sheets("Secondary Budget").Select
ActiveWindow.FreezePanes = False
Range("A1").Select
ActiveSheet.Paste
ActiveWindow.SelectedSheets.Visible = False
Sheets("Primary Budget").Select
curWks.Activate
Range("A1").Select
Application.CutCopyMode = False
Windows("Budget 2007.xls").Activate
End If

End Sub

Aria :)



*** Sent via Developersdex http://www.developersdex.com ***
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 34
Default Toggle Between 2 Windows

Please help. This command will open a file. But on the second time I
activate this command, it errors on me because the file is already open
(thus, I don't need the prompt for choosing a filename). How do you
switch to the file that's already open without the error message?

Dim file1 as string, wkbk as Workbook
file1 = Application.GetOpenFilename
Set wkbk = Workbooks.Open(File1)

Aria :)

*** Sent via Developersdex http://www.developersdex.com ***
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
i want all windows in one excel frame (windows in taskbar) Subramanya Excel Discussion (Misc queries) 1 December 18th 09 03:14 PM
cannot open exel from windows xp in windows vista and visa versa lildiana New Users to Excel 4 February 25th 09 07:26 PM
can windows vista edit shared document from windows xp sasa Excel Worksheet Functions 1 January 9th 08 06:44 PM
Page breaks are different in Windows 2000 and Windows XP Bill Allen Excel Discussion (Misc queries) 1 November 23rd 05 04:42 PM
Use Windows Script to run Windows Explorer Search? Ian Elliott[_3_] Excel Programming 0 January 12th 04 05:03 PM


All times are GMT +1. The time now is 11:42 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"