Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 36
Default run vba code on more than one xl file

Is there a way to run a VBA function on more than one
Excel file at the same time? Preferably without having to
open each file. any direction would be greatly
appreciated. thank you.
peter
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default run vba code on more than one xl file

If by 'at the same time' you mean issuing the same command to multiple
workbooks at the same time, no. You could Process each one sequentially, and
merge the results.

To access closed workbooks, you could use ADO and run a SQL query.

To give more help, we would need to know what you are trying to do.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Peter" wrote in message
...
Is there a way to run a VBA function on more than one
Excel file at the same time? Preferably without having to
open each file. any direction would be greatly
appreciated. thank you.
peter



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 36
Default run vba code on more than one xl file

I would like to know how to do that. The function
basically takes info on one sheet and puts it onto another
sheet in a different desired format. Would there be a way
to write code to make it Open "1.xls", "Run
formatting", "close 1.xls". Open "2.xls", "Run
formatting", "Close "2.xls.", etc. your help is
appreciated. thank you. peter


-----Original Message-----
If by 'at the same time' you mean issuing the same

command to multiple
workbooks at the same time, no. You could Process each

one sequentially, and
merge the results.

To access closed workbooks, you could use ADO and run a

SQL query.

To give more help, we would need to know what you are

trying to do.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Peter" wrote in

message
...
Is there a way to run a VBA function on more than one
Excel file at the same time? Preferably without having

to
open each file. any direction would be greatly
appreciated. thank you.
peter



.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default run vba code on more than one xl file

In simple terms it is this

sFile = "C:\myFiles\1.xls"
Workbooks.Open Filename:=sFile
FormatFile1
Workboks("1.xls").Close

sFile = "C:\myFiles\2.xls"
Workbooks.Open Filename:=sFile
FormatFile2
Workboks("2.xls").Close

sFile = "C:\myFiles\3.xls"
Workbooks.Open Filename:=sFile
FormatFile3
Workboks("3.xls").Close

WhereFormat1,2,3 will fromat the 3 files. I anticipate that you want to copy
them to another book.

Is that okay, or do you need more?

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"peter" wrote in message
...
I would like to know how to do that. The function
basically takes info on one sheet and puts it onto another
sheet in a different desired format. Would there be a way
to write code to make it Open "1.xls", "Run
formatting", "close 1.xls". Open "2.xls", "Run
formatting", "Close "2.xls.", etc. your help is
appreciated. thank you. peter


-----Original Message-----
If by 'at the same time' you mean issuing the same

command to multiple
workbooks at the same time, no. You could Process each

one sequentially, and
merge the results.

To access closed workbooks, you could use ADO and run a

SQL query.

To give more help, we would need to know what you are

trying to do.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Peter" wrote in

message
...
Is there a way to run a VBA function on more than one
Excel file at the same time? Preferably without having

to
open each file. any direction would be greatly
appreciated. thank you.
peter



.



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 36
Default run vba code on more than one xl file

I would like to copy them into a clean worksheet. thanks
again.
-----Original Message-----
In simple terms it is this

sFile = "C:\myFiles\1.xls"
Workbooks.Open Filename:=sFile
FormatFile1
Workboks("1.xls").Close

sFile = "C:\myFiles\2.xls"
Workbooks.Open Filename:=sFile
FormatFile2
Workboks("2.xls").Close

sFile = "C:\myFiles\3.xls"
Workbooks.Open Filename:=sFile
FormatFile3
Workboks("3.xls").Close

WhereFormat1,2,3 will fromat the 3 files. I anticipate

that you want to copy
them to another book.

Is that okay, or do you need more?

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"peter" wrote in

message
...
I would like to know how to do that. The function
basically takes info on one sheet and puts it onto

another
sheet in a different desired format. Would there be a

way
to write code to make it Open "1.xls", "Run
formatting", "close 1.xls". Open "2.xls", "Run
formatting", "Close "2.xls.", etc. your help is
appreciated. thank you. peter


-----Original Message-----
If by 'at the same time' you mean issuing the same

command to multiple
workbooks at the same time, no. You could Process each

one sequentially, and
merge the results.

To access closed workbooks, you could use ADO and run a

SQL query.

To give more help, we would need to know what you are

trying to do.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the

Purbecks
(remove nothere from the email address if mailing

direct)

"Peter" wrote in

message
...
Is there a way to run a VBA function on more than one
Excel file at the same time? Preferably without

having
to
open each file. any direction would be greatly
appreciated. thank you.
peter


.



.



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default run vba code on more than one xl file

Like This?

thisWB = Activeworkbook

sFile = "C:\myFiles\1.xls"
Workbooks.Open Filename:=sFile
Activesheet.Copy After:= thisWB.Worksheets(thisWB.Worksheets.Count)
Workbooks("1.xls").Close

sFile = "C:\myFiles\2.xls"
Workbooks.Open Filename:=sFile
Activesheet.Copy After:= thisWB.Worksheets(thisWB.Worksheets.Count)
Workbooks("2.xls").Close

sFile = "C:\myFiles\3.xls"
Workbooks.Open Filename:=sFile
Activesheet.Copy After:= thisWB.Worksheets(thisWB.Worksheets.Count)
Workbooks("3.xls").Close

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"peter" wrote in message
...
I would like to copy them into a clean worksheet. thanks
again.
-----Original Message-----
In simple terms it is this

sFile = "C:\myFiles\1.xls"
Workbooks.Open Filename:=sFile
FormatFile1
Workboks("1.xls").Close

sFile = "C:\myFiles\2.xls"
Workbooks.Open Filename:=sFile
FormatFile2
Workboks("2.xls").Close

sFile = "C:\myFiles\3.xls"
Workbooks.Open Filename:=sFile
FormatFile3
Workboks("3.xls").Close

WhereFormat1,2,3 will fromat the 3 files. I anticipate

that you want to copy
them to another book.

Is that okay, or do you need more?

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"peter" wrote in

message
...
I would like to know how to do that. The function
basically takes info on one sheet and puts it onto

another
sheet in a different desired format. Would there be a

way
to write code to make it Open "1.xls", "Run
formatting", "close 1.xls". Open "2.xls", "Run
formatting", "Close "2.xls.", etc. your help is
appreciated. thank you. peter


-----Original Message-----
If by 'at the same time' you mean issuing the same
command to multiple
workbooks at the same time, no. You could Process each
one sequentially, and
merge the results.

To access closed workbooks, you could use ADO and run a
SQL query.

To give more help, we would need to know what you are
trying to do.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the

Purbecks
(remove nothere from the email address if mailing

direct)

"Peter" wrote in
message
...
Is there a way to run a VBA function on more than one
Excel file at the same time? Preferably without

having
to
open each file. any direction would be greatly
appreciated. thank you.
peter


.



.



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
Code to create dbase file from text file? Hilton Excel Discussion (Misc queries) 0 October 9th 08 10:37 AM
Opening a file with code without a set file name jenkinspat Excel Discussion (Misc queries) 1 March 4th 05 10:50 AM
Opening a file with code without a set file name jenkinspat Excel Discussion (Misc queries) 1 March 3rd 05 03:40 PM
Opening a file with code without a set file name jenkinspat Excel Discussion (Misc queries) 1 March 2nd 05 03:39 PM
Deleting code in a file with code.. KimberlyC Excel Programming 3 March 4th 04 09:24 PM


All times are GMT +1. The time now is 02:03 AM.

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"