A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Get values of custom variables from customised contact form



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old February 4th 06, 08:08 PM posted to microsoft.public.outlook.program_vba
Michael Anderson
external usenet poster
 
Posts: 19
Default Get values of custom variables from customised contact form

I am trying to use the Scripting.TextStream aspect of FileSystemObject on a
customised contact form. I want every record in the contacts folder to be
exported as a .csv file at the click of a button.

I have tried instantiating the custom variables "mxzParentCompany", "Last
Name", "mxzVIP" & "BusinessAddressCity" as follows, but this only outputs the
data in the immediate record.

Sub mxzcboExportCurrentRecord_Click()

Dim fso, MyFile
Dim txtmxzParentCompany
Dim txtLastName
Dim txtmxzVIP
Dim txtBusinessAddressCity
Dim objInspector

Set fso = CreateObject("Scripting.FileSystemObject")
Set MyFile= fso.CreateTextFile("c:\testfile.txt", True)

Set objInspector = Item.GetInspector

txtmxzParentCompany =
Item.UserProperties_("mxzParentCompany").Value
txtLastName = Item.UserProperties("Last Name").Value
txtmxzVIP = Item.UserProperties("mxzVIP").Value
txtBusinessAddressCity = Item.UserProperties_
("Business Address City").Value
'txtmxzNCRL2 = Item.UserProperties("mxzNCRL2").Value

MyFile.WriteLine(txtmxzParentCompany & " " & txtLastName & " "_ &
txtmxzVIP & " " &_ txtBusinessAddressCity & " ")

MyFile.Close

Set fso = Nothing
Set objInspector = Nothing
Set txtmxzParentCompany = Nothing
Set txtLastName = Nothing
Set txtmxzVIP = Nothing
Set txtBusinessAddressCity = Nothing

End Sub

How can I instantiate the custom variables so that they print out the above
fields from every record in my contact folder?

--
Thank You in Advance,

Michael Anderson
Ads
  #2  
Old February 6th 06, 09:06 PM posted to microsoft.public.outlook.program_vba
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default Get values of custom variables from customised contact form

If the folder is selected use ActiveExplorer.CurrentFolder.Items and iterate
the Items collection. Be aware that Distribution Lists may also be there so
test for the correct message class and handle any errors for DL's. If not
selected then use NameSpace.GetDefaultFolder(olFolderContacts) to get the
Contacts folder and then use its Items collection.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


"Michael Anderson" wrote in
message ...
I am trying to use the Scripting.TextStream aspect of FileSystemObject on a
customised contact form. I want every record in the contacts folder to be
exported as a .csv file at the click of a button.

I have tried instantiating the custom variables "mxzParentCompany", "Last
Name", "mxzVIP" & "BusinessAddressCity" as follows, but this only outputs
the
data in the immediate record.

Sub mxzcboExportCurrentRecord_Click()

Dim fso, MyFile
Dim txtmxzParentCompany
Dim txtLastName
Dim txtmxzVIP
Dim txtBusinessAddressCity
Dim objInspector

Set fso = CreateObject("Scripting.FileSystemObject")
Set MyFile= fso.CreateTextFile("c:\testfile.txt", True)

Set objInspector = Item.GetInspector

txtmxzParentCompany =
Item.UserProperties_("mxzParentCompany").Value
txtLastName = Item.UserProperties("Last Name").Value
txtmxzVIP = Item.UserProperties("mxzVIP").Value
txtBusinessAddressCity = Item.UserProperties_
("Business Address City").Value
'txtmxzNCRL2 = Item.UserProperties("mxzNCRL2").Value

MyFile.WriteLine(txtmxzParentCompany & " " & txtLastName & " "_ &
txtmxzVIP & " " &_ txtBusinessAddressCity & " ")

MyFile.Close

Set fso = Nothing
Set objInspector = Nothing
Set txtmxzParentCompany = Nothing
Set txtLastName = Nothing
Set txtmxzVIP = Nothing
Set txtBusinessAddressCity = Nothing

End Sub

How can I instantiate the custom variables so that they print out the
above
fields from every record in my contact folder?

--
Thank You in Advance,

Michael Anderson


 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Duplicate Contact Detection Outlook 2003 Custom Form [email protected] Outlook - Using Contacts 1 March 20th 06 03:02 PM
Custom Contact Form does not update fields until Outlook is closed Rick Outlook - Using Forms 0 February 21st 06 11:41 PM
Importing in to Custom Contact Form Mark the Outlook Idiot Outlook - Using Contacts 1 February 6th 06 09:53 PM
Need method similar to GotFocus for customised Contact form Michael Anderson Outlook - Using Forms 0 January 24th 06 11:11 PM
Customised Contact Form not being published properly Michael Anderson Outlook - Using Forms 0 January 24th 06 08:10 PM


All times are GMT +1. The time now is 07:56 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright 2004-2025 Outlook Banter.
The comments are property of their posters.