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 - Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Accessing the function across the forms.



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old February 22nd 07, 10:40 PM posted to microsoft.public.outlook.program_forms
Mani
external usenet poster
 
Posts: 12
Default Accessing the function across the forms.

Hi,

I have developed the Custom Form with various user defined functions. My
requirement is to use the same functions in different custom forms. I could
not able to call the functions (Getting an error "object doesn't support this
property or method" ). For example,

Function GetNewItem()
Dim nameSpace, inbox, newItem
Set nameSpace = Application.GetNameSpace("MAPI")
Set inbox = nameSpace.GetDefaultFolder(6)
Set newItem = inbox.Items.Add("IPM.Note.GeneralNavigation")
Set GetNewItem = newItem
End Function

sub cmdimport_click()
dim doc
dim st
set doc=GetNewItem() 'Object created.
set st=xmldoc.getusername() 'Getting error here.
end sub

Please give me the solution on this.
I appreciate your help.

Thanks,
Mani
Ads
  #2  
Old February 22nd 07, 10:54 PM posted to microsoft.public.outlook.program_forms
Sue Mosher [MVP-Outlook]
external usenet poster
 
Posts: 11,651
Default Accessing the function across the forms.

This may sound obvious, but whatever code you want to run each form to run needs to be present in that form's code editor window.

It's not at all clear from what you posted what xmldoc is supposed to be. If you're calling an external component, you need to instantiate that component first.

--
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

"Mani" wrote in message ...
Hi,

I have developed the Custom Form with various user defined functions. My
requirement is to use the same functions in different custom forms. I could
not able to call the functions (Getting an error "object doesn't support this
property or method" ). For example,

Function GetNewItem()
Dim nameSpace, inbox, newItem
Set nameSpace = Application.GetNameSpace("MAPI")
Set inbox = nameSpace.GetDefaultFolder(6)
Set newItem = inbox.Items.Add("IPM.Note.GeneralNavigation")
Set GetNewItem = newItem
End Function

sub cmdimport_click()
dim doc
dim st
set doc=GetNewItem() 'Object created.
set st=xmldoc.getusername() 'Getting error here.
end sub

Please give me the solution on this.
I appreciate your help.

Thanks,
Mani

  #3  
Old February 22nd 07, 11:34 PM posted to microsoft.public.outlook.program_forms
Mani
external usenet poster
 
Posts: 12
Default Accessing the function across the forms.

Hi Sue,

I have created the custom form with the below public function and I want to
use the public function across many forms. For example

Public Function GetData(requireElement)
Dim nodes
Dim i
Dim Element()

Set xmldoc = createobject("MSXML.DOMDOCUMENT")
xmldoc.async="false"
If xmldoc.Load("\\devdata\Admin\Sample.xml") then
Else
Msgbox "Not Loaded..."
End If

Set nodes=xmlDoc.selectNodes(requireElement)
redim preserve Element(nodes.length-1)

for i = 0 to nodes.length-1
Element(i)= nodes(i).Text
next

GetData = Element

End Function

Is it possible to call this function from the another form. I have tried the
below code, but getting an error.

Function GetNewItem()
Dim nameSpace, inbox, newItem
Set nameSpace = Application.GetNameSpace("MAPI")
Set inbox = nameSpace.GetDefaultFolder(6)
Set newItem = inbox.Items.Add("IPM.Note.XMLNavigation")
Set GetNewItem = newItem
End Function

sub cmdimport_click()
dim xmldoc
dim st
set xmldoc=GetNewItem()
set st=xmldoc.GetData("A\B\C") ---- Here getting an same error.

end sub

Please suggest me the solution.

Thanks,
Mani

"Sue Mosher [MVP-Outlook]" wrote:

This may sound obvious, but whatever code you want to run each form to run needs to be present in that form's code editor window.

It's not at all clear from what you posted what xmldoc is supposed to be. If you're calling an external component, you need to instantiate that component first.

--
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

"Mani" wrote in message ...
Hi,

I have developed the Custom Form with various user defined functions. My
requirement is to use the same functions in different custom forms. I could
not able to call the functions (Getting an error "object doesn't support this
property or method" ). For example,

Function GetNewItem()
Dim nameSpace, inbox, newItem
Set nameSpace = Application.GetNameSpace("MAPI")
Set inbox = nameSpace.GetDefaultFolder(6)
Set newItem = inbox.Items.Add("IPM.Note.GeneralNavigation")
Set GetNewItem = newItem
End Function

sub cmdimport_click()
dim doc
dim st
set doc=GetNewItem() 'Object created.
set st=xmldoc.getusername() 'Getting error here.
end sub

Please give me the solution on this.
I appreciate your help.

Thanks,
Mani


  #4  
Old February 23rd 07, 12:47 AM posted to microsoft.public.outlook.program_forms
Sue Mosher [MVP-Outlook]
external usenet poster
 
Posts: 11,651
Default Accessing the function across the forms.

As I indicated earlier, you must copy the function's code into each form you want to use it in.

--
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

"Mani" wrote in message ...

I have created the custom form with the below public function and I want to
use the public function across many forms. For example



"Sue Mosher [MVP-Outlook]" wrote:

This may sound obvious, but whatever code you want to run each form to run needs to be present in that form's code editor window.

It's not at all clear from what you posted what xmldoc is supposed to be. If you're calling an external component, you need to instantiate that component first.



"Mani" wrote in message ...
Hi,

I have developed the Custom Form with various user defined functions. My
requirement is to use the same functions in different custom forms. I could
not able to call the functions (Getting an error "object doesn't support this
property or method" ). For example,

Function GetNewItem()
Dim nameSpace, inbox, newItem
Set nameSpace = Application.GetNameSpace("MAPI")
Set inbox = nameSpace.GetDefaultFolder(6)
Set newItem = inbox.Items.Add("IPM.Note.GeneralNavigation")
Set GetNewItem = newItem
End Function

sub cmdimport_click()
dim doc
dim st
set doc=GetNewItem() 'Object created.
set st=xmldoc.getusername() 'Getting error here.
end sub

Please give me the solution on this.
I appreciate your help.

Thanks,
Mani


 




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
Find function jwb Outlook - Using Contacts 1 December 11th 06 05:32 PM
Creating Organizational Forms Library & Publish Forms akafrog18 Outlook - Using Forms 1 August 1st 06 04:26 PM
Outlook 2003 - Forms Icon On toolbar doesn't list any forms Kim.in.Denver Outlook - Using Forms 8 July 28th 06 04:35 PM
OE InBox Does Not Function Chris B Outlook Express 2 June 23rd 06 02:24 PM
Email Message Forms in Personal Forms Library Debbie Hadsel Outlook - Using Forms 4 May 30th 06 06:11 PM


All times are GMT +1. The time now is 03:36 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-2025 Outlook Banter.
The comments are property of their posters.