I generate an email in an application access in vba.
At the end I wish to put a hyperlink but the email is in raw and not in html. Do you have a solution?
DoCmd.SendObject , , , "adressmail#hotmail.com", "", "", " " & Types & " de " & Prenom & " " & Nom & " prend effet le " & Effet_au & "", "Madame, Monsieur," & vbCrLf & vbCrLf & "texte" & **"LINK HERE"** & vbCrLf, True, ""
You can change the email to HTML by setting the format in the third parameter to
acFormatHTML. This will mean that the entire email message will have to be in HTML however.
Related
I'm creating a utility for a game that creates spreadsheets of data by reading the game's code.
One of the most basic aspects of this is being able to read the game's code efficiently. The game is written in C#. I'm using VB.Net for my program because my mind can't grasp the abstraction of more complex languages. Historically the way I had my program recognise code blocks in the code text file is by counting the brackets that encapsulated them and working off of that. This seems a bit clunky, though. Is there any simpler way to help the program figure out code blocks?
For Example, code in the text file might look like this:
6673={
key="d_example_duchy_1"
de_facto_liege=12
variables={
data={ {
flag="traditional_de_jure_kingdom"
tick=0
data={
type=lt
identity=6632
}
}
}
}
de_jure_liege=6632
de_jure_vassals={ 6674 6678 6682 6686 }
holder=558
name="Example Duchy 1"
date=1253.1.1
heir={ 880 }
history={ 1253.1.1=558 }
capital=6674
history_government="tribal_government"
coat_of_arms_id=2320
}
6674={
key="c_example_county_1"
variables={
data={ {
flag="influx_culture"
tick=0
data={
type=culture
identity=11
}
}
{
flag="influx_faith"
tick=0
data={
type=faith
identity=57
}
}
{
flag="fog_resistance"
tick=0
data={
type=value
}
}
}
}
de_jure_liege=6673
de_jure_vassals={ 6675 6676 6677 }
holder=558
name="Example County 1"
date=1243.6.26
heir={ 880 }
capital=6674
coat_of_arms_id=2323
}
6675={
key="b_example_barony_1"
de_facto_liege=6674
de_jure_liege=6674
holder=558
name="Example Barony 1"
date=1254.1.1
capital_barony=yes
duchy_capital_barony=yes
capital=6674
coat_of_arms_id=2328
}
6676={
key="b_example_barony_2"
de_facto_liege=6674
de_jure_liege=6674
holder=11609
name="Example Barony 2"
date=1253.7.28
capital=6674
coat_of_arms_id=2332
}
6677={
key="b_example_barony_3"
de_facto_liege=6674
de_jure_liege=6674
holder=558
name="Example Barony 3"
date=1232.2.8
heir={ 880 }
capital=6674
theocratic_lease=yes
coat_of_arms_id=2334
}
Thanks in advance. :)
The solution I eventually settled on, for discerning the overall code-blocks (e.g. all the data nested under 6674={ ... }) was basically:
Dim Code As String = File.ReadAllText("PATH/TO/CODE/FILE.txt")
Dim Output As List(Of String) = Code.Split(vbCrLf & "}" & vbCrLf).ToList
So in plain English, reading all the code into a single string, then splitting the string according to how the original code's language distinguished the initial nest of code (i.e. a carriage return followed by a curly bracket followed by another carriage return).
The list at the end would look something like this:
Output(0)
6673={" & vbCrLf & " key=""d_example_duchy_1""" & vbCrLf & " de_facto_liege=12" & vbCrLf & " variables={" & vbCrLf & " data={ {" & vbCrLf & " flag=""traditional_de_jure_kingdom""" & vbCrLf & " tick=0" & vbCrLf & " data={" & vbCrLf & " type=lt" & vbCrLf & " identity=6632" & vbCrLf & " }" & vbCrLf & " }" & vbCrLf & " }" & vbCrLf & " }" & vbCrLf & " de_jure_liege=6632" & vbCrLf & " de_jure_vassals={ 6674 6678 6682 6686 }" & vbCrLf & " holder=558" & vbCrLf & " name=""Example Duchy 1""" & vbCrLf & " date=1253.1.1" & vbCrLf & " heir={ 880 }" & vbCrLf & " history={ 1253.1.1=558 }" & vbCrLf & " capital=6674" & vbCrLf & " history_government=""tribal_government""" & vbCrLf & " coat_of_arms_id=2320
Output(1)
6674={" & vbCrLf & " key=""c_example_county_1""" & vbCrLf & " variables={" & vbCrLf & " data={ {" & vbCrLf & " flag=""influx_culture""" & vbCrLf & " tick=0" & vbCrLf & " data={" & vbCrLf & " type=culture" & vbCrLf & " identity=11" & vbCrLf & " }" & vbCrLf & " }" & vbCrLf & " {" & vbCrLf & " flag=""influx_faith""" & vbCrLf & " tick=0" & vbCrLf & " data={" & vbCrLf & " type=faith" & vbCrLf & " identity=57" & vbCrLf & " }" & vbCrLf & " }" & vbCrLf & " {" & vbCrLf & " flag=""fog_resistance""" & vbCrLf & " tick=0" & vbCrLf & " data={" & vbCrLf & " type=value" & vbCrLf & " }" & vbCrLf & " }" & vbCrLf & " }" & vbCrLf & " }" & vbCrLf & " de_jure_liege=6673" & vbCrLf & " de_jure_vassals={ 6675 6676 6677 }" & vbCrLf & " holder=558" & vbCrLf & " name=""Example County 1""" & vbCrLf & " date=1243.6.26" & vbCrLf & " heir={ 880 }" & vbCrLf & " capital=6674" & vbCrLf & " coat_of_arms_id=2323
And so on with the remaining three.
Been trying to figure out if there is a way to deserialize this object below. the problem is the api returns the data in this format. There seems to be an object here called Info that is listof()..
"found=23" & vbCrLf & "info[0].Channel=0" & vbCrLf & "info[0].EndTime=2020-05-11 00:59:59" & vbCrLf & "info[0].EnteredSubtotal=0" & vbCrLf & "info[0].ExitedSubtotal=0" & vbCrLf & "info[0].RuleName=NumberStat" & vbCrLf & "info[0].StartTime=2020-05-11 00:00:00" & vbCrLf & "info[1].Channel=0" & vbCrLf & "info[1].EndTime=2020-05-11 01:59:59" & vbCrLf & "info[1].EnteredSubtotal=0" & vbCrLf & "info[1].ExitedSubtotal=0" & vbCrLf & "info[1].RuleName=NumberStat" & vbCrLf & "info[1].StartTime=2020-05-11 01:00:00" & vbCrLf & "info[2].Channel=0" & vbCrLf & "info[2].EndTime=2020-05-11 02:59:59" & vbCrLf & "info[2].EnteredSubtotal=0" & vbCrLf & "info[2].ExitedSubtotal=0" & vbCrLf & "info[2].RuleName=NumberStat" & vbCrLf & "info[2].StartTime=2020-05-11 02:00:00" & vbCrLf & "info[3].Channel=0" & vbCrLf & "info[3].EndTime=2020-05-11 03:59:59" & vbCrLf & "info[3].EnteredSubtotal=0" & vbCrLf & "info[3].ExitedSubtotal=0" & vbCrLf & "info[3].RuleName=NumberStat" & vbCrLf & "info[3].StartTime=2020-05-11 03:00:00" & vbCrLf & "info
Thanks in advance for any ideas here.
Looks like it is VBscript.
vbCrLf means new line so:
"found=23"
"info[0].Channel=0"
"info[0].EndTime=2020-05-11 00:59:59"
"info[0].EnteredSubtotal=0"
"info[0].ExitedSubtotal=0"
"info[0].RuleName=NumberStat"
"info[0].StartTime=2020-05-11 00:00:00"
"info[1].Channel=0"
"info[1].EndTime=2020-05-11 01:59:59"
"info[1].EnteredSubtotal=0"
"info[1].ExitedSubtotal=0"
"info[1].RuleName=NumberStat"
"info[1].StartTime=2020-05-11 01:00:00"
"info[2].Channel=0"
"info[2].EndTime=2020-05-11 02:59:59"
"info[2].EnteredSubtotal=0"
"info[2].ExitedSubtotal=0"
"info[2].RuleName=NumberStat"
"info[2].StartTime=2020-05-11 02:00:00"
"info[3].Channel=0"
"info[3].EndTime=2020-05-11 03:59:59"
"info[3].EnteredSubtotal=0"
"info[3].ExitedSubtotal=0"
"info[3].RuleName=NumberStat"
"info[3].StartTime=2020-05-11 03:00:00"
I think this might be useful:
How to run VBScript in .net core or .net standard project?
I have a textbox in a form. I use this textbox to write "Codes" and then I save it in the table in the database through the SQL insert statement, but the code doesn't accept to run and gives me an error message:
Run-Time error '3075'.
type of database: Access database
type of field data: LongText
What the problem and how to pass all same problems when I need to save codes inside the database field.
When I try to save the code without (') it's working!
I use this SQL Statement:
CurrentDb.Execute "Update Tbl_Codes Set [LP_ID]= " & Me.txtID & ",
[Code_Title]='" & Me.txtTitle & "'" _
& " ,[Code_Des]= '" & Me.txtDes & "',[Code_Key]= '" & Me.txtKey & "',
[Notes]= '" & Me.txtNotes & "'" _
& " Where [ID]= " & Me.txtID1 & ""
And I want to save this Code:
DSum("Field1";"Table";"Field2= '" & Value & "'")
Please change your code as follows. You need to escape single quotes by doubling them up. A simple replace will work for your.
CurrentDb.Execute "Update Tbl_Codes Set [LP_ID]= " & Replace(Me.txtID,"'","''") & ",
[Code_Title]='" & Replace(Me.txtTitle,"'","''") & "'" _
& " ,[Code_Des]= '" & Replace(Me.txtDes,"'","''") & "',[Code_Key]= '" & Replace(Me.txtKey,"'","''") & "',
[Notes]= '" & Replace(Me.txtNotes,"'","''") & "'" _
& " Where [ID]= " & Me.txtID1 & ""
DSum("Field1";"Table";"Field2= '" & Replace(Value,"'","''") & "'")
I am creating some emails through vba in excel. Currently using the html method for the email body and adding the mail body text by combining values of different cells in a worksheet. I clearly marked the font as Calibri 11 and it is creating the mails with the required font but some users get the mail with different font in email body.
Also, the recipients who are facing this problem have the "Dear" part and "Thank you " part showing as Calibri 11 but the rest of the content in Times New Roman 12. Can someone please help me with this issue.
The code for email body is like this:
.htmlbody = "<body style = 'font-size:11pt; font-family:Calibri; color:RGB(0,0,0);'>" & y & vbNewLine & _
"<p>" & varPart1 & varPart2 & "<sup>" & varPart3 & "</sup>" & varPart4 & varPart5 & "<sup>" & _
varPart6 & "</sup>" & varPart7 & "</p>" & _
"<p>" & varPart8 & "</p>" & _
"<p><span>" & varPart9 & "</span></p>" & _
"<span>" & varPart10 & "</body>"
What I'm trying to do is to copy a range from Excel (2 columns) and to paste in into email body in Outlook. I'd like to get also 2 columns in email body but I still receive everything in one line. Here's my code:
Tresc = "Cześć" & vbCr & vbCr & " słówko/a na dzisiaj to:" & vbCr & vbCr & Tresc & vbNewLine
'utworzenie hiperłącza
Hiperlacze = "mailto:" & Trim(LCase(Adres)) & _
"?subject=" & Tytul & _
"&body=" & Tresc
I believe you are looking for the vbCRLF built-in for "carriage return/linefeed" instead of just vbCR.
Since this is a mailto-link, there are some other rules in play. Replace the vbCr with "%0D%0A".
Example:
Tresc = "Cześć%0D%0Asłówko/a na dzisiaj to:" 'etc.