Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Les Les is offline
external usenet poster
 
Posts: 240
Default Execute code in a loop - Question

Hello all, i am not a programmer so forgive the type of questions. Is it
possible to run code to manipulate a document if it is opened within a loop
and once finished the loop continues ?
--
Les
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 523
Default Execute code in a loop - Question

Hi Les, yes it is:

sub demo()

dim wb as work book
dim s as string
dim i as integer

s= "C:\Filepath\File.xls"

for i = 1 to 10
Set wb = Workbooks.Open(s, False)

'Write your code in here

wb.Close
next i

end sub


"Les" wrote:

Hello all, i am not a programmer so forgive the type of questions. Is it
possible to run code to manipulate a document if it is opened within a loop
and once finished the loop continues ?
--
Les

  #3   Report Post  
Posted to microsoft.public.excel.programming
Les Les is offline
external usenet poster
 
Posts: 240
Default Execute code in a loop - Question

Thanks Sam, much appreciated
--
Les


"Sam Wilson" wrote:

Hi Les, yes it is:

sub demo()

dim wb as work book
dim s as string
dim i as integer

s= "C:\Filepath\File.xls"

for i = 1 to 10
Set wb = Workbooks.Open(s, False)

'Write your code in here

wb.Close
next i

end sub


"Les" wrote:

Hello all, i am not a programmer so forgive the type of questions. Is it
possible to run code to manipulate a document if it is opened within a loop
and once finished the loop continues ?
--
Les

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
Loop works correctly but takes extremely long to execute robs3131 Excel Programming 6 June 20th 07 03:29 PM
Execute code from book1 of code from book2 Rick Excel Programming 4 June 5th 07 05:19 PM
Trying to execute function after negative if conditional nested in For each loop Red[_5_] Excel Programming 0 August 21st 06 09:14 PM
Execute Code gti_jobert[_48_] Excel Programming 2 March 2nd 06 09:37 AM
ADO command.execute with a loop - only runs once George King Excel Programming 0 February 9th 06 06:24 PM


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