![]() |
VBScript - load a data from a file and create a new Outlook contact!
hey guys!
I'd like to crate a vbs script which could load specific data from a file.. name, lastname, e-mail e.g. john, smith, world, john@world.com and so on.. and then create a new contact in outlook application using those values. To create a new contact i could you sth like this: Const olContactItem = 2a Dim objOutl, objContact Set objOutl = WScript.CreateObject("Outlook.Application") Set objContact = objOutl.CreateItem(olContactItem) objContact.FirstName = "john" objContact.LastName = "smith" objContact.Email1Address = "john@world.com" objContact.Save() But i'm not able to create a procedure which could load that data from a file, could you please help me with that. Jack |
Re: VBScript - load a data from a file and create a new Outlook contact!
Here is a simple solution to the problem.
Code: VB
|
Re: VBScript - load a data from a file and create a new Outlook contact!
Quote:
just one thing, when im trying to run it, i got an error: "Expected end of statement" so i removed 'a' from ' Const olContactItem = 2a' then i got an error: "Invalid procedure call or argument" in this line: "Set oTF = oFSO.OpenTextFile(InpFile,ForReading,True)" i tried to add 'Option Explicit' but then i get: "variable is undefined: 'For Reading''" ... |
Re: VBScript - load a data from a file and create a new Outlook contact!
You need to include the library with the constant definitions the post here
http://p2p.wrox.com/archive/beginnin...2002-06/53.asp explains. the line you need to add goes before the <head> it should read : <!-- METADATA TYPE=3D"typelib" FILE=3D"C:\windows\system32\scrrun.dll" --> Note: the location of scrrun.dll may differ and is system dependant. Dale |
Re: VBScript - load a data from a file and create a new Outlook contact!
I'd like to do the same thing but also create some distribution lists at the same time. I am a complete newbie when it comes to this- can I drop that code (listed above) in a .wsf file and run it from the commandline?
Also, when I looked at the library to include, it seems you are including it as it would be on a webpage- I assume the syntax would be completely different in a .wsf file on a local machine, but have no clue what that syntax would be. Any help would be greatly appreciated, Thanks -Tom |
| All times are GMT +5.5. The time now is 12:58. |