Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
tamato43
 
Posts: n/a
Default Macro to open specific File

Is there a way to Create a macro to save current file and then Open a new
file, by specifying one for sure.
  #2   Report Post  
Chip Pearson
 
Posts: n/a
Default

Try something like

Sub AAA()
ActiveWorkbook.Save
Workbooks.Open Filename:="C:\whatever.xls"
End Sub


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"tamato43" wrote in message
...
Is there a way to Create a macro to save current file and then
Open a new
file, by specifying one for sure.



  #3   Report Post  
tamato43
 
Posts: n/a
Default

Thanks

"Chip Pearson" wrote:

Try something like

Sub AAA()
ActiveWorkbook.Save
Workbooks.Open Filename:="C:\whatever.xls"
End Sub


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"tamato43" wrote in message
...
Is there a way to Create a macro to save current file and then
Open a new
file, by specifying one for sure.




  #4   Report Post  
tamato43
 
Posts: n/a
Default

Will this completely close the file before opening a new one? or do I need to
manually do that?

"Chip Pearson" wrote:

Try something like

Sub AAA()
ActiveWorkbook.Save
Workbooks.Open Filename:="C:\whatever.xls"
End Sub


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"tamato43" wrote in message
...
Is there a way to Create a macro to save current file and then
Open a new
file, by specifying one for sure.




  #5   Report Post  
Dave Peterson
 
Posts: n/a
Default

It doesn't close that other workbook.

But with the code in a third workbook:

Sub AAA()
ActiveWorkbook.close savechanges:=true
Workbooks.Open Filename:="C:\whatever.xls"
End Sub

(if the code is in the workbook that gets closed, then as soon as you close the
workbook, the macro will stop--so it won't open the "whatever.xls" workbook.)

One way around that is to open the new workbook and then close the other
workbook with the code in it.

Sub AAA()
Workbooks.Open Filename:="C:\whatever.xls"
ThisWorkbook.close savechanges:=true
End Sub

tamato43 wrote:

Will this completely close the file before opening a new one? or do I need to
manually do that?

"Chip Pearson" wrote:

Try something like

Sub AAA()
ActiveWorkbook.Save
Workbooks.Open Filename:="C:\whatever.xls"
End Sub


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"tamato43" wrote in message
...
Is there a way to Create a macro to save current file and then
Open a new
file, by specifying one for sure.





--

Dave Peterson
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
Excel file does not open Marcin Excel Discussion (Misc queries) 2 April 29th 05 05:46 PM
csv file will not open Scott Randolph New Users to Excel 0 April 29th 05 02:18 AM
Button fails to call macro when open an Excel via Intranet tigertax Excel Discussion (Misc queries) 1 April 12th 05 10:21 AM
hidden rows & columns slow file open Simon Shaw Excel Discussion (Misc queries) 0 April 5th 05 12:21 AM
Office 2003 - "autocomplete" in file | open or file | save no longer works Lanwench [MVP - Exchange] Excel Discussion (Misc queries) 4 January 12th 05 01:35 AM


All times are GMT +1. The time now is 08:27 PM.

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

About Us

"It's about Microsoft Excel"