B
Brad
Thanks for taking the time to read my question.
What I would like to do is create something like
(e-mail address removed); (e-mail address removed); (e-mail address removed)
The data that this would be generated from is in a table, and if I use a
query to get at it I get...
(e-mail address removed);
(e-mail address removed);
(e-mail address removed)
I want my users to be able to select the e-mail addresses, copy them and be
able to past them into the To: line on their chosen e-mail editor. To do
this the e-mail addresses must be in a string, each value separated by a ;
and a space.
I have tried using the Print # statement(example below), but that still
places the values one below another. In html it doesn't matter if they're
placed one below another, so I made the code below. It works, but I'd like a
solution that remains with in the Access97 db that I'm creating.
The ideal solution would be to have a text box that can hold all the values,
then the user could copy them from there.
If you try to create a string out of the addresses, you will run out of
room, as there is a max of 255 characters.
Is there something like Print # that writes horizontally?
Thanks so much for reading this really long question.
Here is what I've done so far:
What I would like to do is create something like
(e-mail address removed); (e-mail address removed); (e-mail address removed)
The data that this would be generated from is in a table, and if I use a
query to get at it I get...
(e-mail address removed);
(e-mail address removed);
(e-mail address removed)
I want my users to be able to select the e-mail addresses, copy them and be
able to past them into the To: line on their chosen e-mail editor. To do
this the e-mail addresses must be in a string, each value separated by a ;
and a space.
I have tried using the Print # statement(example below), but that still
places the values one below another. In html it doesn't matter if they're
placed one below another, so I made the code below. It works, but I'd like a
solution that remains with in the Access97 db that I'm creating.
The ideal solution would be to have a text box that can hold all the values,
then the user could copy them from there.
If you try to create a string out of the addresses, you will run out of
room, as there is a max of 255 characters.
Is there something like Print # that writes horizontally?
Thanks so much for reading this really long question.
Here is what I've done so far:
Code:
Function ExportEMails()
Dim rst As Recordset, dbs As Database, qdf As QueryDef
Dim x, y As Integer
Set dbs = CurrentDb
If Forms!frmContacts!UseSelectedNames = 0 Then
Set qdf = dbs.QueryDefs("qryContactEmailAll")
Set rst = qdf.OpenRecordset()
Else
Set qdf = dbs.QueryDefs("qryContactEmailJustList")
Set rst = qdf.OpenRecordset()
End If
rst.MoveFirst
If Not rst.EOF Then
x = 0
Do Until rst.EOF
x = x + 1
rst.MoveNext
Loop
Open "C:\Program Files\MMexe\EmailAddresses.htm" For Output As #1 ' Open
file for output.
Print #1, "<html>"
Print #1, "<head>"
Print #1, "<meta http-equiv=""" & "Content-Type""" & "; content = """ &
"text/html; charset=iso-8859-1""" & " >"
Print #1, "<title>List of E-Mail Addresses</title>"
Print #1, "<script LANGUAGE=""" & "JavaScript""" & ">"
Print #1, "<!--"
Print #1, "function copyit(theField) {"
Print #1, "var tempval=eval(""" & "document.""" & "+theField)"
Print #1, "tempval.focus()"
Print #1, "tempval.select()"
Print #1, "therange=tempval.createTextRange()"
Print #1, "therange.execCommand(""" & "Copy""" & ")"
Print #1, "}"
Print #1, "//-->"
Print #1, "</script>"
Print #1, "</head>"
Print #1, "<body bgcolor=""" & "#ffff99""" & ">"
Print #1, "<table width=""" & "80%""" & " align=""" & "center""" & "
border=""" & "0""" & " cellpadding=""" & "0""" & " cellspacing=""" & "0""" &
" title=""" & "E-Mail Addresses""" & ">"
Print #1, "<caption align=""" & "top""" & ">Copy this list of e-mail
addresses by selecting all addresses or press the Copy button.</caption>"
Print #1, "<tr>"
Print #1, "<td> </td>"
Print #1, "</tr>"
Print #1, "<tr>"
Print #1, "<td align=""" & "center""" & ">"
Print #1, "<form name=""" & "it""" & ">"
Print #1, "<textarea name=""" & "select1""" & " rows=""" & "10""" & "
cols=""" & "35""" & ">"
rst.MoveFirst
y = 0
Print #1, rst!ContactEMail & "; "
Do Until y = x - 1
Print #1, rst!ContactEMail & "; "
y = y + 1
rst.MoveNext
Loop
Print #1, rst!ContactEMail
Print #1, "</textarea>"
Print #1, "<br>"
Print #1, "<br>"
Print #1, "<input onclick=""" & "copyit('it.select1')""" & " type=""" &
"button""" & " value=""" & "Press to Copy the E-Mail Addresses""" & "
name=""" & "cpy""" & ">"
Print #1, "</form>"
Print #1, "</td>"
Print #1, "</tr>"
Print #1, "<tr>"
Print #1, "<td align=""" & "center""" & ">If you have Internet Explorer 5.5
or higher, have Service Pack 2, and have the pop-up blocker on for MS XP
operating system, click the pop-up blocker bar and select Allow Blocked
Content. Then the Copy button will work.</td>"
Print #1, "</tr>"
Print #1, "</table>"
Print #1, "</body>"
Print #1, "</html>"
Close #1 ' Close file.
End If
End Function