Split Varible

J

Joel Allen

Hello ,

I get this error "Expected end of statement" on this line:

Dim v as Variant

Here are my global variables:

Option Explicit
Dim m_blnWeOpenedWord
Dim m_blnWordPrintBackground
Const wdDoNotSaveChanges = 0
Dim ins
Dim pgs
Dim pg
Dim ctls
Dim ctl
Dim JobNameNumber
Dim v as Variant
Dim FirstNamee
Dim LastNamee

And here is where I am running the code:

v=Split("John Smith", " ")
FirstNamee=v(0)
LastNamee=v(1)

Item.UserProperties("ContactName").Value = FirstNamee

Thanks for your help,
Joel
 
J

Joel Allen

I tried that and get the same error. Any other ideas?

Thanks for your help,
Joel
 
J

jaf

Joel,
You test with the item object.


Option Explicit
Dim m_blnWeOpenedWord
Dim m_blnWordPrintBackground
Const wdDoNotSaveChanges = 0
Dim ins
Dim pgs
Dim pg
Dim ctls
Dim ctl
Dim JobNameNumber
Dim v() As String
Dim x As String
Dim FirstNamee
Dim LastNamee

'And here is where I am running the code:
Sub test()

x = "John Smith"
v = Split(x, " ")

FirstNamee = v(0)
LastNamee = v(1)
Debug.Print FirstNamee, LastNamee

'Item.UserProperties("ContactName").Value = FirstNamee

End Sub
 
J

Joel Allen

Thanks for your help.

I still get the error "Expected end of statement" on these 2 lines:

Dim v() As String
Dim x As String

Any ideas?

Thanks,
Joel
 
S

Sue Mosher [MVP-Outlook]

This is VBScript code? Comment out the As clauses.

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top