Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
Dar Dar is offline
external usenet poster
 
Posts: 25
Default Looping Macros that change

I have 14 worksheets. Each worksheet has a different email address in A2
The macro assoicated with that worksheet references a particular file that
will be emailed, ie.On worksheet 1 C:\Myfiles\FA2E.snp, but on worksheet2 the
file will be C:\Myfiles\FA3E.snp. etc. I need to loop through each worksheet
and have it run a different macro for each sheet.[ I think] unless someone
knows how to enter all 14 files, separate email addresses and loop through
them from one macro.

It's been a bear finding code that would send an email via Lotus Notes with
a file attached without having to hit the send button, but I found one a
forum. That was the first hurdle, now I need to call 14 different macros or
at least loop through 14 different variables.
Any help out ther?
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,203
Default Looping Macros that change

You didn't say where on the worksheets the filename is stored at. But it
really shouldn't matter much, what I'm giving you is a bare-bones skeleton of
the program logic that should work

Sub CreateEmails()
Dim anySheet As Worksheet
Dim eMailAddress as String
Dim File2Email as String

For Each anySheet In ThisWorkbook.Worksheets
eMailAddress = anySheet.Range("A2").Value
'just using X15 as a placeholder - provide current cell reference
FileToEmail = anySheet.Range("X15").Value
'
' your code here to send email via Lotus Notes
'
Next ' go on to next sheet
End Sub

"Dar" wrote:

I have 14 worksheets. Each worksheet has a different email address in A2
The macro assoicated with that worksheet references a particular file that
will be emailed, ie.On worksheet 1 C:\Myfiles\FA2E.snp, but on worksheet2 the
file will be C:\Myfiles\FA3E.snp. etc. I need to loop through each worksheet
and have it run a different macro for each sheet.[ I think] unless someone
knows how to enter all 14 files, separate email addresses and loop through
them from one macro.

It's been a bear finding code that would send an email via Lotus Notes with
a file attached without having to hit the send button, but I found one a
forum. That was the first hurdle, now I need to call 14 different macros or
at least loop through 14 different variables.
Any help out ther?

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
Change excel columns through macros Chandrasekaran P Excel Discussion (Misc queries) 3 May 10th 07 11:12 PM
In Macros within the autofiltered icon to change data how possible Vijay Kotian Excel Discussion (Misc queries) 0 September 5th 06 04:45 PM
Assigned macros change location markvi Excel Discussion (Misc queries) 3 April 6th 06 06:48 PM
Looping macros using VB code accessuser1308 Excel Discussion (Misc queries) 2 March 9th 05 11:11 PM
Change default path for assigning macros AuthorizedUser Setting up and Configuration of Excel 1 January 30th 05 07:06 PM


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