Ho un problema abbastanza serio con la formattazione di testo ed immagini insieme.
Per eseguire l'operazione di solito uso questo codice:

'''''''''''''''''''''''''''''''''''''''
<%
dim RicercApri
set RicercApri=Conn.execute("select * from articoli where idtipo=1 AND idcat=12 AND NOT data=""temp"" ORDER BY idart DESC")
If NOT RicercApri.eof then
varApri=RicercApri("idart")
%>
<tr><td height="5"></td></tr>
<tr><td class="testo">
<%
strMSQL="select * from mediasuart where idart=" &varApri&" and NOT align=""attach"""
set media=conn.execute(strMSQL)
''''''conto il numero di media allegati'''''''''''''''''''''''''''''''''''''''''' '''''''''''''
set quantiMedia=Conn.execute("Select count(*) as quanti from mediasuart where idart="&varApri &" and NOT align=""attach""")
If media.eof then
%>
<p style="text-align:justify;float:left; margin:4px;"><%=RicercApri("testo")%></p>
<%
Else
for i=0 to quantiMedia.fields("quanti")-1
varMedia=media("idmedia")
strMdSQL="select * from mediateca where idmedia=" &varMedia
set mediains=Conn.execute(strMdSQL)
If mediains("larghezza")>mediains("altezza") then
larghezza=100
altezza=((mediains.fields("altezza")*larghezza)/mediains.fields("larghezza"))
Else
altezza=100
larghezza=((mediains.fields("larghezza")*altezza)/mediains.fields("altezza"))
End if
%>
<div>
<a href="#" onClick="Winfoto(<%=varMedia%>);">
<img style="margin:2px;" src=<%="back/images/"&mediains("nome_file")%> border=0 align="<%=media("align")%>" alt="clicca sull'immagine per vederla nelle sue dimensioni reali" width=<%=larghezza%> height=<%=altezza%>>
</a><p style="text-align:justify;margin-left:8px;"><%= mid(RicercApri("testo"),(i*(int(len(RicercApri("te sto"))/quantiMedia("quanti"))))+1,int(len(RicercApri("tes to"))/quantiMedia("quanti")))%></p></div>
<%
media.movenext
next
End if
%>

</td></tr>
<% End if %>
</table>

'''''''''''''''''''''''''''''''''''''''''''''''''' ''''''
Di solito il codice funziona bene; ho visto però che ci sono diversi problemi quando si utilizzano nel testo tag HTML: l'esempio classico è quello dei linik, che diventano inservibili perchè spezzati dalla funzione.
Sto provandop da parecchio tempo a risolvere il problema,utilizzando le funzioni di formattazione stringa in modo isolare i campi link

[ più o meno in questo modo ]

'''''''''''''''''''''''''''''''''''''''''''''''''' '''''
set listamedia=conn.execute(strSQL)
set quantimedia=conn.execute("select count(*) as quanti from index_articoli_mediateca where idart="&varmediart)
if listamedia.eof then
%>
<div valign="top" style="text-align:justify;margin-left:5px;margin-right:5px;"><%=articoli("testo")%></div>
<%
else
posIn=1
rec=0
testo=articoli("testo")

do until listamedia.eof
'for i=0 to quantimedia("quanti")-1
set media=conn.execute("select * from mediateca where idmedia="&listamedia("idmedia")&" AND NOT tipologia=""all""")
if media.eof=false then
larghezza=media("larghezza")
altezza=media("altezza")
alt=media("testo")
align=listamedia("align")
valign=listamedia("valign")
if altezza > 200 then
larghresize=200
alteresize=int((larghresize*altezza)/larghezza)
else
larghresize=larghezza
alteresize=altezza
end if
%>
<div valign="top" style="margin-left:5px;margin-right:5px;text-align:justify">
<img style="margin-left:2px;margin-top:2px;margin-right:2px;margin-bottom:4px;float:<%=align%>;vertical-alignment:<%=valign%>" src=<%="mediateca/"&media("percorso") %> border=0 alt=<%=alt%> width=<%=larghresize%> height=<%=alteresize%>>
<span style="text-align:justify;margin:4px;">
<%
'MyPos=Instr(posIn,articoli("testo"),"<a",1)
MyPos=Instr(posIn,testo,"<a",1)
'response.write "MyPos="&Instr(posIn,testo,"<a",1)
'"testo="&testo&"
inziolink="&MyPos&"
finelink="&posIn&"
"
if MyPos=0 then
response.write articoli("testo")
else
posIn=Instr(MyPos,testo,"/a>",1)
'response.write "posIn="&posIn
stringainiziale=Left(testo,MyPos-1)
'response.write "stringainiziale="&stringainiziale
'stringapiulink=Left(testo,(posIn+3))
'response.write "
stringapiulink="&stringapiulink
'-(Len(testo)+int(posIn))
link=Mid(testo,MyPos,((posIn+2)-(Len(stringainiziale))))
'link=Right(stringapiulink,Len(testo)-Len(stringainiziale))
testo=stringainiziale&link
'response.write "stringain="&stringainiziale&"
"
'response.write "link="&link&""
response.write testo
'response.write "resto="&Right(articoli("testo"),(Len(articoli("te sto"))-Len(testo)))
'response.write "stringainiz="&stringainiziale&"
"
'codicelink=Mid(articoli("testo"),MyPos+1,(Len(art icoli("testo"))-Len(stringainiziale)))
'response.write "codicelink="&codicelink
'testo=stringainiziale&codicelink
'response.write "testo="&testo&"
"'stringainiziale="&stringainiziale&"
finelink="&finelink&"
MyPos="&MyPos&"
"
testo=Right(articoli("testo"),(Len(articoli("testo "))-(Len(testo)+2)))
end if
'posIn=posIn+1

%>
</span></div>
<%
end if
set media=nothing
rec=rec+1

'response.write "<font color=#ff0000>testo=" &testo&"
</font>"
'response.write "finelink="&posIn&"
"
'testo= Mid(articoli("testo"),MyPos,Instr(articoli("testo" ),posIn))
listamedia.movenext
loop
end if
'''''''''''''''''''''''''''''''''''''''''''''''''' '''''''''''''''''''' [ ]


ma ancora non sono riuscito a trovare niente di accettabile. Se qualcuno di voi ci è già passato, per favore mi aiuti!!!