Problem with hyperlink URL length (1 Viewer)

Atomic Shrimp

Humanoid lifeform
Local time
Today, 15:12
Joined
Jun 16, 2000
Messages
1,954
My application contains a table with contact details for >500 people, including their email addresses - on one of my forms, I have various ways to filter subsets of these records - what I would like to do is create a button or hyperlink that launches a mailto: for the currently filtered set of email addresses.

I already have code that builds the list, and that works fine, but...

if I insert it into the hyperlink property of a hyperlink object, it gets truncated to 255 characters

If I try to use it as a parameter for Application.FollowHyperlink, it's better, but generates runtime error 87 ('an unexpected error has occurred') if it's longer than about 1000 characters

Can anyone think of a workaround for this? I guess I could use Outlook automation, but I'm hoping there will be something a bit simpler.

(for the record, and in case anyone was concerned, the purpose of this db is not to spam people - it's a business application that sends things out to employees of the business - and the size of the distribution list shouldn't get rejected at the mail server, because that is also inside the business)
 

vbaInet

AWF VIP
Local time
Today, 15:12
Joined
Jan 22, 2010
Messages
26,374
My application contains a table with contact details for >500 people, including their email addresses - on one of my forms, I have various ways to filter subsets of these records - what I would like to do is create a button or hyperlink that launches a mailto: for the currently filtered set of email addresses.

I already have code that builds the list, and that works fine, but...

if I insert it into the hyperlink property of a hyperlink object, it gets truncated to 255 characters

If I try to use it as a parameter for Application.FollowHyperlink, it's better, but generates runtime error 87 ('an unexpected error has occurred') if it's longer than about 1000 characters

Can anyone think of a workaround for this? I guess I could use Outlook automation, but I'm hoping there will be something a bit simpler.

(for the record, and in case anyone was concerned, the purpose of this db is not to spam people - it's a business application that sends things out to employees of the business - and the size of the distribution list shouldn't get rejected at the mail server, because that is also inside the business)


Why don't you break it down in small manageable chunks? You could even create an algorithm that could split it evenly and create a thread to run the different chunks at succession. You would count the number of recipients, and also count the length of each of their e-mail addresses. The two things you could work with
 

Atomic Shrimp

Humanoid lifeform
Local time
Today, 15:12
Joined
Jun 16, 2000
Messages
1,954
Sending emails from the system directly (and individually) to any number of contacts I already have - a mailto: hyperlink doesn't directly send the email - it just opens it in a window for the user to complete.

And that's what I want - the hyperlink to open a single blank email addressed to the filtered list of recipients (so that the user can send ad-hoc messages to filtered groups of people). Feeding it chunks will open multiple blank email messages.
 
Last edited:

vbaInet

AWF VIP
Local time
Today, 15:12
Joined
Jan 22, 2010
Messages
26,374
Is it your code that handles the sending of the e-mails?
 

Atomic Shrimp

Humanoid lifeform
Local time
Today, 15:12
Joined
Jun 16, 2000
Messages
1,954
The code that generates the distribution list I'm trying to use is mine (the string of semicolon+space-separated email addresses it creates is valid - I've copied and pasted it out of the debug window and it works)

The code I'm using to generate and send emails (not related to this operation though) is based on Dev Ashish's outlook automation code
 

Banana

split with a cherry atop.
Local time
Today, 07:12
Joined
Sep 1, 2005
Messages
6,318
Why not use CDO so you can hold the objects in memory and build the list without those restrictions?
 

Atomic Shrimp

Humanoid lifeform
Local time
Today, 15:12
Joined
Jun 16, 2000
Messages
1,954
I didn't even know what that means... I looked it up - it sounds like a method of scripting the transmission of emails directly without bothering an installed mail client- am I right?

Not sure that will be appropriate here, as the sent messages need to go via Outlook - for several reasons - including creation of a proper audit trail, but also, because corporate policy will probably not ever stretch as far as to permit me access to the exchange server by any other method.
 

vbaInet

AWF VIP
Local time
Today, 15:12
Joined
Jan 22, 2010
Messages
26,374
So all your code does is fill in the recipients box and that's as far as it goes right?
 

Banana

split with a cherry atop.
Local time
Today, 07:12
Joined
Sep 1, 2005
Messages
6,318
Yeah - CDO is a library that allows you to use SMTP, and you can have CDO route through the Outlook/Exchange as well so I believe this should satisfy the audit trail requirement.
 

Atomic Shrimp

Humanoid lifeform
Local time
Today, 15:12
Joined
Jun 16, 2000
Messages
1,954
So all your code does is fill in the recipients box and that's as far as it goes right?

That's all I want it to do, for this particular function - to create a blank, pre-addressed email, ready for the user to type an ad-hoc message to the selected group of recipients.
 

vbaInet

AWF VIP
Local time
Today, 15:12
Joined
Jan 22, 2010
Messages
26,374
Sounds like you need the CreateObject() function which you would use to create an Outlook object. Try investigating that. I've never had to do anything with Outlook of recent.

And if you manage the above, use a string instead and just trim it.
 

vbaInet

AWF VIP
Local time
Today, 15:12
Joined
Jan 22, 2010
Messages
26,374

Atomic Shrimp

Humanoid lifeform
Local time
Today, 15:12
Joined
Jun 16, 2000
Messages
1,954
Thanks - yeah, I'm already using Outlook automation like that for the bulk of sending individual messages with atached documents direct out of the system with no user interaction to the message - I guess I was just being lazy trying to do this blank message thing with a hyperlink.
 

Users who are viewing this thread

Top Bottom