Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Replacing strings - data merge
Message
From
29/03/2001 14:20:40
 
 
To
All
General information
Forum:
Visual Basic
Category:
Other
Title:
Replacing strings - data merge
Miscellaneous
Thread ID:
00490006
Message ID:
00490006
Views:
39
I'm trying to include a data merge type of functionality in to my current project but need some assistance.

My current code looks like this:
Do
  lngPos = InStr(1, strMemo, "@PURCHASEORDERID", vbTextCompare)
  If lngPos = 0 Then
     Exit Do
  End If
  strMemo = Mid(strMemo, 1, lngPos - 1) & _
     mobjPurchaseOrder.PurchaseOrderID & _
     Mid(strMemo, lngPos + 16)
Loop
As you can see, it loop thru the string and replaces the string as needed. This works for one but what if I want to check every property in my object for existance of the matching tag string and do a similar replace? Is there a cool way to do this w/o hard-coding the strings to lookup?

Something like this that works:
For Each Property In mobjPurchaseOrder.Properties
  lngPos = InStr(1, strMemo, "@" & Property.Name, vbTextCompare)
  If lngPos = 0 Then
     Exit Do
  End If
  intLen = Len(Property.Name)
  strMemo = Mid(strMemo, 1, lngPos - 1) & _
     Property.Value & _
     Mid(strMemo, lngPos + intLen)
Next
It's "my" world. You're just living in it.
Next
Reply
Map
View

Click here to load this message in the networking platform