Outlook Banter

Outlook Banter (http://www.outlookbanter.com/)
-   Outlook - Using Forms (http://www.outlookbanter.com/outlook-using-forms/)
-   -   Use field in outlook custom form to populate excel sheet (http://www.outlookbanter.com/outlook-using-forms/32615-use-field-outlook-custom-form.html)

Jade November 11th 06 07:54 PM

Use field in outlook custom form to populate excel sheet
 
Hello everyone,

I have an excel sheet ("Test") which in range ("D3") I would like to
add the field ("txtName") from a custom outlook calendar form
("Page2"). I realize I'm missing a step. Can someone lend me some
assistance?

Thanks...



Sub cmdGetExcel_Click()
dim myIns,strName
strName="C:\Documents and Settings\Jackie\My Documents\OutlookTest.xls"
set myIns=item.getinspector
set myPage=myIns.modifiedformpages("Page2")
set txtName=myPage.Controls("txtName")

set appExcel=createobject("Excel.Application")
appExcel.workbooks.open (strName)
appExcel.application.visible=true
set wkb=appExcel.activeworkbook
set wks=wkb.Worksheets("Sheet1")
wks.activate
set rng=wks.Range("D3")
rng.value=item.userproperties("txtName")
Set appExcel = Nothing
End Sub


Sue Mosher [MVP-Outlook] November 29th 06 09:38 PM

Use field in outlook custom form to populate excel sheet
 
txtName sounds like the name of a control, not the name of a field. Since you're treating it as both below, it's impossible to know which is correct. The syntax for both is covered at http://www.outlookcode.com/d/propsyntax.htm

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003
http://www.turtleflock.com/olconfig/index.htm
and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx

"Jade" wrote in message ups.com...
Hello everyone,

I have an excel sheet ("Test") which in range ("D3") I would like to
add the field ("txtName") from a custom outlook calendar form
("Page2"). I realize I'm missing a step. Can someone lend me some
assistance?

Thanks...



Sub cmdGetExcel_Click()
dim myIns,strName
strName="C:\Documents and Settings\Jackie\My Documents\OutlookTest.xls"
set myIns=item.getinspector
set myPage=myIns.modifiedformpages("Page2")
set txtName=myPage.Controls("txtName")

set appExcel=createobject("Excel.Application")
appExcel.workbooks.open (strName)
appExcel.application.visible=true
set wkb=appExcel.activeworkbook
set wks=wkb.Worksheets("Sheet1")
wks.activate
set rng=wks.Range("D3")
rng.value=item.userproperties("txtName")
Set appExcel = Nothing
End Sub



All times are GMT +1. The time now is 09:50 AM.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2006 OutlookBanter.com