Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Anyone Know Workbook Openening & Saving Macro Alternatives?

Hi,

I have a user that is using a Macro in Exel 2002, that is opening and
saving a number of files .xls files.
He has about 50 of these subs, opening and saving a different file
every time. Is there a better way of achieving the same thing without
having to open & save all the documents, as you can imaging, opening &
saving all of these documents can take a very long time.

Sub Network1()
'
' Network1 Macro
' Macro recorded 05/01/2004 by Iain McLachlan
'

'
Workbooks.Open Filename:= _
"\\<netwotk_path\<file_name.xls"
Sheets("Data").Select
Range("A1").Select
Selection.QueryTable.Refresh BackgroundQuery:=False
ActiveWorkbook.Save
ActiveWindow.Close
End Sub
Sub Network2()
'
' Network2 Macro
' Macro recorded 05/01/2004 by Iain McLachlan
'

'
Workbooks.Open Filename:= _
"\\<netwotk_path\<file_name.xls"
Sheets("Data").Select
Range("A1").Select
Selection.QueryTable.Refresh BackgroundQuery:=False
ActiveWorkbook.Save
ActiveWindow.Close
End Sub


I did input the following into each sub:

Application.ScreenUpdating = True
Workbooks.Open Filename:= _
"\\<netwotk_path\<file_name.xls"
Sheets("Data").Select
Range("A1").Select
Selection.QueryTable.Refresh BackgroundQuery:=False
ActiveWorkbook.Save
ActiveWindow.Close
Application.ScreenUpdating = True

This seems to have helped a bit, but the constant file opening &
closing. Thanks for any help in advance, much appreciated

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,355
Default Anyone Know Workbook Openening & Saving Macro Alternatives?

You may be able to adapt something from this. I have a worksheet with the
filepath in column A and the filename in column G.

Sub Transfer()

newPath = "Z:\TRANSFER TEST"
For i = 2 To Cells(Rows.Count, "A").End(xlUp).row
currentPath = Cells(i, "A").Value
Filename = Cells(i, "G").Value
Debug.Print currentPath, Filename, newPath, Filename
'copy currentPath & "\" & Filename As newPath & "\" & Filename
FileCopy currentPath & "\" & Filename, newPath & "\" & Filename

Next i

End Sub

HTH,
Barb Reinhardt

" wrote:

Hi,

I have a user that is using a Macro in Exel 2002, that is opening and
saving a number of files .xls files.
He has about 50 of these subs, opening and saving a different file
every time. Is there a better way of achieving the same thing without
having to open & save all the documents, as you can imaging, opening &
saving all of these documents can take a very long time.

Sub Network1()
'
' Network1 Macro
' Macro recorded 05/01/2004 by Iain McLachlan
'

'
Workbooks.Open Filename:= _
"\\<netwotk_path\<file_name.xls"
Sheets("Data").Select
Range("A1").Select
Selection.QueryTable.Refresh BackgroundQuery:=False
ActiveWorkbook.Save
ActiveWindow.Close
End Sub
Sub Network2()
'
' Network2 Macro
' Macro recorded 05/01/2004 by Iain McLachlan
'

'
Workbooks.Open Filename:= _
"\\<netwotk_path\<file_name.xls"
Sheets("Data").Select
Range("A1").Select
Selection.QueryTable.Refresh BackgroundQuery:=False
ActiveWorkbook.Save
ActiveWindow.Close
End Sub


I did input the following into each sub:

Application.ScreenUpdating = True
Workbooks.Open Filename:= _
"\\<netwotk_path\<file_name.xls"
Sheets("Data").Select
Range("A1").Select
Selection.QueryTable.Refresh BackgroundQuery:=False
ActiveWorkbook.Save
ActiveWindow.Close
Application.ScreenUpdating = True

This seems to have helped a bit, but the constant file opening &
closing. Thanks for any help in advance, much appreciated


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Anyone Know Workbook Openening & Saving Macro Alternatives?

On May 21, 2:59 pm, Barb Reinhardt
wrote:
You may be able to adapt something from this. I have a worksheet with the
filepath in column A and the filename in column G.

Sub Transfer()

newPath = "Z:\TRANSFER TEST"
For i = 2 To Cells(Rows.Count, "A").End(xlUp).row
currentPath = Cells(i, "A").Value
Filename = Cells(i, "G").Value
Debug.Print currentPath, Filename, newPath, Filename
'copy currentPath & "\" & Filename As newPath & "\" & Filename
FileCopy currentPath & "\" & Filename, newPath & "\" & Filename

Next i

End Sub

HTH,
Barb Reinhardt


Thanks for the suggestion Barb, I'll get the user to try editing all
of that! :-)

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
saving macro from workbook to Personal Macro Workbook KrispyData Excel Discussion (Misc queries) 1 March 25th 10 05:52 PM
Saving a workbook step in a Macro Mark Excel Discussion (Misc queries) 3 October 2nd 08 10:08 PM
Saving Workbook via Macro WLMPilot Excel Programming 3 February 5th 07 05:53 PM
Updateing worksheets when openening workbook a94andwi Excel Programming 1 July 4th 05 03:56 PM
Saving a workbook as PDF in Macro David McRitchie Excel Programming 1 June 23rd 04 09:49 PM


All times are GMT +1. The time now is 06:59 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"