Outlook.mailitem - diferent replace result when not displayed

Hello everybody!
I am developing an app to generate personalized emails from Excel file and .msg template.
In the template, I insert "variables" like this: ^name^,
which means that is is a placeholder for values from "name" column in source
Excel file.
this template is saved as .msg file on local disc and used as an argument in.CreateItemFromTemplate()
after loading the template , it cycles from all the columns and rows of the Excel file and replaces the inserted
variables:
loading excel:
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim fpath As String
OpenFileDialog1.ShowDialog()
fpath = OpenFileDialog1.FileName
workbook = APP.Workbooks.Open(fpath)
worksheet = APP.ActiveSheet
Dim CellData As String
Dim LastCol As Long
Dim LastRow As Long
Dim bunka As String
LastCol = workbook.ActiveSheet.UsedRange.Columns.Count
LastRow = workbook.ActiveSheet.UsedRange.Rows.Count
objData = worksheet
DataGridView1.ColumnCount = 1
DataGridView1.Columns(0).Name = "Column"
DataGridView1.Columns(0).Width = 130
For i = 1 To LastCol
bunka = worksheet.Cells(1, i).Value
Combo_To.Items.Add(bunka)
Combo_SaveName.Items.Add(bunka)
Dim row As String() = New String() {bunka}
DataGridView1.Rows.Add(row)
Next
Dim btn As New DataGridViewButtonColumn()
DataGridView1.Columns.Add(btn)
btn.HeaderText = "Use"
btn.Text = "+"
btn.Name = "btn"
btn.Width = 50
btn.UseColumnTextForButtonValue = True
btn.CellTemplate.Style.BackColor = System.Drawing.Color.Green
Combo_To.SelectedIndex = 1
End Sub
after that the DataGridView1 loosk like this:
the "+" buttons are used to insert text variables into the mail body.
code for inserting is, this works fine:
Private Sub grdData_CellContentClick(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.CellContentClick
Dim colName As String = DataGridView1.Columns(e.ColumnIndex).Name
If e.RowIndex < 0 Then Exit Sub
If colName = "btn" Then
Dim variable As String
variable = "^" & DataGridView1.Item(0, e.RowIndex).Value & "^"
My.Computer.Clipboard.SetText(variable)
objOutlookMsgY.GetInspector().Activate()
SendKeys.Send("^v") 'Paste
End If
End Sub
code for generating email from template:
Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click
Dim sessionName As String
Dim docas As Object
Dim variable As String
Dim dosazeno As String
Dim SavePath As String
Dim objOutlookMsgTEMP As Outlook.MailItem
worksheet = APP.ActiveSheet
objOutlookMsgY.SaveAs("C:\temp_msg2.msg")
clip = objOutlookMsgY.HTMLBody
MsgBox("clip saved")
sessionName = InputBox("Name this session:", "New Session", Today & "_")
SavePath = RootFolder & "\" & sessionName & "\_Initial session"
My.Computer.FileSystem.CreateDirectory(SavePath)
For radek = 2 To workbook.ActiveSheet.UsedRange.Rows.Count
ToolStripProgressBar1.Maximum = workbook.ActiveSheet.UsedRange.Rows.Count - 1
objOutlookMsgTEMP = objOutlook.CreateItemFromTemplate("C:\temp_msg2.msg")
' objOutlookMsgTEMP.Display()
For i = 1 To DataGridView1.RowCount
variable = Convert.ToString("^" & worksheet.Cells(1, i).value & "^")
dosazeno = Convert.ToString(worksheet.Cells(radek, i).value)
'wait(50)
Debug.Print("*" & variable & "*" & " >>> " & "*" & dosazeno & "*")
objOutlookMsgTEMP.HTMLBody = objOutlookMsgTEMP.HTMLBody.Replace(variable, dosazeno)
objOutlookMsgTEMP.HTMLBody = Replace(objOutlookMsgTEMP.HTMLBody, variable, dosazeno)
'wait(50)
objOutlookMsgTEMP.To = worksheet.Cells(radek, ToCol + 1).value
Next
objOutlookMsgTEMP.SendUsingAccount = accounts(Combo_From.SelectedIndex + 1)
Dim objDoc As Microsoft.Office.Interop.Word.Document
Dim objBkm As Microsoft.Office.Interop.Word.Bookmark
'On Error Resume Next
objDoc = objOutlookMsgTEMP.GetInspector.WordEditor
objBkm = objDoc.Bookmarks("_MailAutoSig")
If Not objBkm Is Nothing Then
objBkm.Select()
objDoc.Windows(1).Selection.Delete()
End If
objDoc = Nothing
objBkm = Nothing
objOutlookMsgTEMP.SaveAs(SavePath & "\" & worksheet.Cells(radek, Combo_SaveName.SelectedIndex + 1).value & ".msg")
' objOutlookMsgTEMP.Send()
ToolStripProgressBar1.Value = radek - 1
objOutlookMsgTEMP.Close(SaveMode:=Outlook.OlInspectorClose.olDiscard)
Next
End Sub
for replacing is used this:
.....objOutlookMsgTEMP.Display()
objOutlookMsgTEMP.HTMLBody = objOutlookMsgTEMP.HTMLBody.Replace(variable, valueFromExcel).....
or
.....objOutlookMsgTEMP.HTMLBody = Replace(objOutlookMsgTEMP.HTMLBody, variable, valueFromExcel).....
after replacing, the new message is saved as .msg or send
the problem:
everything works fine when the message is displayed while replacing. But when not displayed, only SOME variables
are replaced. I don't really understand why there is such difference in the result and why only SOME are
not replaced. I have tried changing the columns's names but found no connection between it and the result. when the message is displayed it takes like 10 times longer and makes the PC unusable.
real example:
the tamplate:
^jmeno^
^email^
^prij^
^jmeno3^
^sec code^
result, message displayed:
Jakub
[email protected]
Dxxx
16
266548
result, message not displayed:
^jmeno^
[email protected]
^prij^
4
449447
I have also tried adding some Wait functions, didn't help. I would really appreciate if you could help me
figure this out and explain why this happens. Thank you

Please also copy the below two vars from the debugger window and paste here as it is.
Debug.Print("*" & variable & "*" & " >>> " & "*" & dosazeno & "*")
Also send us you message template, you can send only the section where the two non working vars exist.
Fouad Roumieh

Similar Messages

  • Using photoshop elements 9 as an external editor - after saving in Photoshop the results do not display in Aperture

    I set up my external editor as Photoshop Elements 9, I follow the instructions to edit a selected image in the external editor. When finished editing in Photoshop, I hit Save (not Save As), and go back to Aperture, and the work I did in Photoshop does not display in Aperture. Is there anything else I need to do to make the work I did in Photoshop display in Aperture?

    I had the same problem with PSE 10, and this soution worked for me.  Thanks.  But is this the real answer?  Isn't there a way to save the file without having to add an "f" to the suffix?  It doesn't seem to make sense to me.  Is it an Aperture problem or PSE?  I went to the Apple store amnd the so-called aperture/photoshop expert spent an hour trying to figure it out and finally got the answer by reading this post!!!

  • User Search result is not displaying

    Hello friends,
    i am facing new problem in the Portal, when i am searching any user in User Admin-> search.
    its dislaying some  information but its not displaying the Contact information.
    can any one perovide me some help in this regard...
    This error i am getting..
    Unparseable date: "en_US".
    Exception id: 03:44_27/03/08_0056_7377050
    See the details for the exception ID in the log file
    Regards.

    did you check the log file under
    http://host:port/nwa--monitoring-logs and traces-sap logs

  • Amazon search results do not display properly as of Firefox 33.0

    Hello,
    This one is a bit strange. Lately, I've noticed that many (but not all) search results on Amazon display only eight items per page, even though the Amazon site believes it is showing me 48 results. It is as if the rest of the results are hidden behind the "next page" control.
    To reproduce:
    1) go to amazon.com.
    2) In the search bar, enter a search term that will get lots of results. For example "sweaters women"
    3) On the resulting page, go to the side menu, and choose a sub category - for example, "Women's sweaters".
    4) Look at the resulting page. It will tell you "1-48 of 37,824 results ..." but you will (or at least, *I*) only see eight items -- two rows of four. Directly underneath the second row is the grey bar that shows the pages and the "previous" and "next" links. Underneath *that* is a very large white space, which looks about the right size to contain the remaining rows of results -- but they are not there.
    Do you see what I'm seeing? It's strange, and it just started a short time ago. I'm only now really looking into it, and IE and Safari both show me the search results as I expect.
    I am running Windows 7 and Firefox 33.0.
    Thanks for looking.

    No problems here.
    I do see 48 results as 12 row of each 4 results.
    You can try these steps in case of issues with web pages:
    You can reload web page(s) and bypass the cache to refresh possibly outdated or corrupted files.
    *Hold down the Shift key and left-click the Reload button
    *Press "Ctrl + F5" or press "Ctrl + Shift + R" (Windows,Linux)
    *Press "Command + Shift + R" (Mac)
    Clear the cache and remove cookies only from websites that cause problems.
    "Clear the Cache":
    *Firefox/Tools > Options > Advanced > Network > Cached Web Content: "Clear Now"
    "Remove Cookies" from sites causing problems:
    *Firefox/Tools > Options > Privacy > "Use custom settings for history" > Cookies: "Show Cookies"
    Start Firefox in <u>[[Safe Mode|Safe Mode]]</u> to check if one of the extensions (Firefox/Tools > Add-ons > Extensions) or if hardware acceleration is causing the problem.
    *Switch to the DEFAULT theme: Firefox/Tools > Add-ons > Appearance
    *Do NOT click the Reset button on the Safe Mode start window
    *https://support.mozilla.org/kb/Safe+Mode
    *https://support.mozilla.org/kb/Troubleshooting+extensions+and+themes

  • Size of resulting file not displayed within Preview

    Under Snow Leopard, when you were saving a file from within Preview, you were shown the size of the resultant file, and the effect on this size as you changed the quality.  Under OS X 7, Preview, you can still change the quality of the file that you are saving, but Preview does not appear to display the size of the resultant file.  Can this be turned back on, and if so, how?

    Hi
    When you embed the .swf inside a html page just specify the new object width and height (preferably keep aspect ratio). If your symbol/object/sprite inside the the movie are all vector, you should not suffer any quality loss.
    If your movie has raster image (e.g. jpg), you'll need to open the original .fla and use flash to resize the stage/canvas and everything inside it.
    If you don't have the .fla source, try open your .swf file using swf decompiler software (like sothink) and convert it back to .fla, then use flash to resize it.
    Thanks
    Puneet

  • Outlook 2010/Exchange 2007 Calendar Will Not Display

    Hi Folks,
    I've been working on an issue for the past 3 weeks and would love some assistance.
    Here's the problem:
    A user indicated that she was using Outlook normally, flipping between the Mail and Calendar tab. When she went back to the Calendar tab, the navigation pane switched to the Calendar tab, but the main pane and ribbon were still showing Mail content.
    The only way for her to display her Calendar properly is to right-click on Calendar and select "Open in New Window" - but even then if she goes to the Mail tab, she cannot go back to her Calendar again.
    Please note we are running on Exchange version 8.3.327.1
    Here are the fixes I've attempted:
    New OST file
    New Mail profile
    Ran outlook.exe with the following switches:  /safe /cleanrules /cleanview /resetfolders /resetnavpane 
    Please note: resetnavpane breaks the OST file and requires me to create a new OST file for the user
    Open Mailbox on a different computer - that same issue occurs
    Open Mailbox in webmail - the calendar is displayed properly
    Odds n Ends: Hitting CTRL + 6, Hitting F5.
    I've run out of ideas and would appreciate any ideas to resolve this problem
    Thanks!
    Derek

    Hi Derek,
    It should not be an Exchange issue. Based on my research, there is no feature in Exchange server can configure the Outlook reading pane or navigation pane performance. Since there is only one user encounter this issue and OWA can work well, please check
    the following points to narrow down the issue:
    1. Please configure your Outlook account in your colleague’s domain-joined computer with your colleague’s domain account to check whether the issue is caused by your Roaming Profile.
    2. Configure Outlook account outside the domain by using Outlook Anywhere to check whether the issue is caused by any policy in your domain.
    Thanks,
    Winnie Liang
    TechNet Community Support

  • Result region not displaying values properly from backend table

    HI All,
    We have a search page wherein we have added a new column called grade range in the table as well as in the search region.The new column is mapped to a altogether new column which
    is created in the database table with a default value.The table in the search page has Entity object assosciated with it which is taking care of all the DML operations.
    The name of the newly created item in the serach region is grade range which has three value coming from lookup like 12 ,13 and all,and also the new column
    created in the database table has default value of all.
    When we are trying to query the results in the search page with the filter criteria of any value for grade range, then we are able to see the records in the result table but with the column grade range being null. But When we update any record in the result table , then we are able to see the value for grade range column for updated records after submit.
    And this behaviour of the search page is after the data base refresh. Before that, it was working fine.

    Hi,
    I hope, these two characterstics are from different base cubes. SO you are getting two rows. I hope, it is not possible to display those two rows(what you explained in the example) in a single row. This is very common property of Multi provider. To solve this problem you have to enhance one of DS to include both characterstics and it should feed the data to one cube only. Then you have to built the query directly on that cube.
    With rgds,
    Anil Kumar Sharma .P

  • Query Result is not displaying *

    Hi,
    I am developing a new report. In that there are two key figures namely "Inter Company In Transit Qty" and " WIP Qty".
    Inter Company In Transit Qty Key figures have different UOM
    and WIP QTY Key figure is having different UOM.
    When I run the query, the result for Inter Company In Tranist Qty is displaying * which is correct (as it is having multiple UOM).
    where as WIP Qty  is having multiple UOM, hence it should show the result as *, but it is showing  EA which is wrong.
    I checked every property of Inter Company In trasit and WIP Qty and they all look same.
    Please advice me what should be done in WIP Qty result line should be asterisk and not 0.00 EA.
    Thanks
    Madhav

    Hi Danny
    Thanks for your response.
    Yes both key figures are coming from same infoprovider.
    I created a mulitprovider based on two infocubes. One is daily and other is Monthly.
    Both key figures are non cumulative key figures.  For both key figures I used below mentioned  logic. Intransit is working fine.
    I created a formula and put in calculated key figures(CKF).  The CKF formula is    ((WIP Qty > 0.1) * WIP QTY)
    I took a selection and used the CKF and restricted by daily cube.
    I changed the result as suggest by you . But it still does not work.
    Any suggestions is greatly appricated.
    Thanks,
    Madhav

  • Outlook 2013 Bug - Categories Column Does Not Display Color In Certain Positions

    My System: Outlook 2013-64 on Windows 7-64
    When looking at my email list (preview pane off), the categories column displays its color and text. But when the Categories column is moved to the left of the "from" column, it ceases to display its color and displays only its text, even when
    the column is wide enough to display everything for a category.
    Can someone tell me  how to fix this?
    This did not happen in Outlook 2010 and 2007.

    Hi,
    I just confirmed this issue exists on Outlook 2013, when categories
    column is dragged to the left to From, the categories don't display the colors but label texts instead.
    While I didn't find this issue on Outlook 2010 or Outlook 2007.
    Thank you for being so careful and pointing out this problem, whenver you have any feedback about this product, you can always press Ctrl + Alt + 7(Send a Smile) or Ctrl + Alt + 8(Send a Frown) to submit it. Currently I cannot promise the
    deadline when it will be fixed, but Microsoft will definitely hear users' voice and make its products better and easy to use.
    Regards,
    Melon Chen
    TechNet Community Support

  • Outlook integration: All day activities are not displayed correclty

    All day activities in MSA do not replicate correctly in outlook. If I create an all day activity in outlook, the activity is syncronized so I will find the appointment in outlook, but it will not be marked as all day appointment, and the time will not be from 12 am to 12 am of that day. Instead, I found that the system keeps the duration of the activity to 12 hours, but not starting and finishing in the same day.
    However, when those all day appointments are created in outlook, they are refleted as all day activities in MSA so it works fine.
    Thanks for your help,
    ALVARO

    Hi Alvaro,
    Can you please tell me which version of MSA you have?
    Thanks & Regards,
    Rashmi

  • Checksum error when not displaying [row selector]

    Hi !
    In my tabular form, I need no row selector, so I unchecked the check box "Show" on the "Report Attributes" page.
    But this leads to a checksum-error when updating a record and pressing "Submit".
    What's the reason and why does it happen ?
    Heinz

    Hi Patrick.
    No I've not tried it, bit I will try it after Christmas and post the result.
    I've realized, that changing a column from "Text field" to "Standard Report Column" or vice versa may lead to checksum errors - but I have no idea how and why a non-database field like the row selector has influence upon the checksum - again some misterious behavior of ApEx tabular forms.
    Heinz

  • 3.1EA1: Query results do not display

    The results of any query I run in 3.1EA1 do not show in the Query Result tab. When I run sqldeveloper.exe from the command prompt, there are no errors. Sqldeveloper 3.0 is fine.
    Oracle Database: 10.2.0.4.0
    Java version: 1.6.0_26
    Operation System: Windows XP Prod sp3

    Hi Raghu,
    Yes, you are correct. It seems to be related to SQLHistory. This is what I did.
    -- Deleted everything in the SQLHistory folder as suggested.
    -- Started SQLDeveloper and ran query from worksheet
    -- Got results fine, but then immediately got a dialog box saying Migrating SQL history.
    -- This produced an error
    source: o.d.worksheet.sqlhistory
    message: sun.nio.cs.StreamDecoder.forInputStreamReader (StreamDecoder.java:52)
    -- After it finished, sql history was filled again with all the files.
    -- Restarted SQLDeveloper and the problem was back.
    -- Discovered in the SQLDeveloper directory (at same level as the SQLHistory folder) another file called SQLHistory.xml (presumably from a previous version which was the one being migrated)
    -- Renamed the previous sqlhistory.xml file and the issue seems to have gone away since only my new SQL in the history folder now.
    However, I assume that over time, the problem will come back when history gets to a certain size ? I did have about 1200 entries in my folder before deleting.
    Will there be a fix for this, as I use sql history quite often ?
    Hope this helps track down the problem.
    Thanks,
    Mark

  • Search result is not displaying in SharePoint 2010

    Hi,
      For one web application only we are not getting any search results. All the site collections are of team site template. Contents are there in search scope. crawl is running fine. Disableloopbackcheck has been done. But still no result. The web
    app has an alternate access mapping in the intranet zone.
    Any help would be appreciated.

    Resolved it by changing the AAM properly

  • Select * from v$asm_disk query results are not displayed in developer

    Hi, executing select * from v$asm_disk query returns below error messages whereas select * from v$asm_diskgroup works fine.
    SEVERE     40     18579     oracle.dbtools.raptor.nls.OracleNLSProvider     Error loading nls:ORA-01219: database not open: queries allowed on fixed tables/views only
    SEVERE     38     0     oracle.dbtools.raptor.utils.Connections     
    SEVERE     37     15     oracle.dbtools.db.DBUtil     Warning, unhandled exception: ORA-15021: parameter "plsql_debug" is not valid in asm instance
    SEVERE     36     0     oracle.dbtools.db.DBUtil     Warning, unhandled exception: ORA-15021: parameter "plsql_optimize_level" is not valid in asm instance
    SEVERE     35     0     oracle.dbtools.db.DBUtil     Warning, unhandled exception: ORA-15021: parameter "plscope_settings" is not valid in asm instance
    Is there any way to get around this issue?
    Thanks
    Pramod

    What product are you using? What version, what database? What user is the query being run by? (It may be a privileges issue)
    This forum is for the product SQL Developer Data Modeler.
    Sue

  • Search results not displayed properly

    Hi,
    I've found a bug in my application. I have programmed a search field which is used to filter the results returned by the report query. When the page loads it displays all the items in the database. If i want to filter the results i type in the search field, click go and the results are filtered accordingly. It works perfectly. BUT it fails if the following scenario occurs:
    - i clear the search field and click go so I have all the records in the database contained in the report again (only displaying 1-15 of 300+)
    - i then click on the Next button to display records 15-30 (only 15 records are displayed per page).
    - if i perform a search on this second page, the results are not displayed. The report says 'Displaying 1-2 of 2 results' for example, along with table column headings, but nothing in the report.
    In other words my search only seems to work if it is done on the first page of results. I'm thinking I may need to clear the cache or something, but I dont know exactly what to do. Any help would be appreciated.
    Tom

    No worries, I sussed it. Had to add a process to the page to reset pagination.

Maybe you are looking for