Reply
 
Thread Tools Display Modes
  #1   Report Post  
Robert Mulroney
 
Posts: n/a
Default VBA function results in fields

Is it possible to have a document field return the result of a macro
function? I'm hopeing to have a field that would call a particular function
each time it is updated and display the results. It's important that I'm able
to pass a parameter to the function. The function might look sometimg like:


public function foo(param as integer) as string

.....
'some calculations
......

foo = "my string"

end function


I'm aware that it's possible to update fields from macros but is it possible
to have a field update itself?


  #2   Report Post  
Suzanne S. Barnhill
 
Posts: n/a
Default

You have posted this in an end-user NG; you would get a better response if
you post in one of the word.vba (programming) NGs.

--
Suzanne S. Barnhill
Microsoft MVP (Word)
Words into Type
Fairhope, Alabama USA
Word MVP FAQ site: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.

"Robert Mulroney" wrote in
message ...
Is it possible to have a document field return the result of a macro
function? I'm hopeing to have a field that would call a particular

function
each time it is updated and display the results. It's important that I'm

able
to pass a parameter to the function. The function might look sometimg

like:


public function foo(param as integer) as string

....
'some calculations
.....

foo = "my string"

end function


I'm aware that it's possible to update fields from macros but is it

possible
to have a field update itself?



  #3   Report Post  
Jezebel
 
Posts: n/a
Default

Use a double-barrel approach: insert a DocProperty or DocVariable field to
display your variable; then in your macro use the result to set the value of
the document property or document variable and update fields.


"Robert Mulroney" wrote in
message ...
Is it possible to have a document field return the result of a macro
function? I'm hopeing to have a field that would call a particular
function
each time it is updated and display the results. It's important that I'm
able
to pass a parameter to the function. The function might look sometimg
like:


public function foo(param as integer) as string

....
'some calculations
.....

foo = "my string"

end function


I'm aware that it's possible to update fields from macros but is it
possible
to have a field update itself?




  #4   Report Post  
Cindy M -WordMVP-
 
Posts: n/a
Default

Hi ?B?Um9iZXJ0IE11bHJvbmV5?=,

Is it possible to have a document field return the result of a macro
function? I'm hopeing to have a field that would call a particular function
each time it is updated and display the results. It's important that I'm able
to pass a parameter to the function.

No, this simply is not possible in Word. Too bad...

Closest you could get in Word would be a MacroButton field that the user would
have to click.

Other than that, I can only imagine using something as a macro trigger (either a
keyboard shortcut or a specific application event) to update information in the
document. There are various things you could use as a "target".

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or reply
in the newsgroup and not by e-mail :-)

Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Repost: Record 1 contained too few data fields HJ Mailmerge 0 May 20th 05 01:27 PM
ASK and FILLIN fields in INCLUDETEXT documents do not merge correc ChrisM Mailmerge 3 April 12th 05 04:05 AM
Word Compare and Merge Document Function EricM Microsoft Word Help 2 March 28th 05 11:53 PM
Attempting to auto-update fields in a word document Sanin R Microsoft Word Help 1 January 7th 05 07:39 PM
posting data from text input fields to fields later in document BOB Microsoft Word Help 1 November 23rd 04 07:19 PM


All times are GMT +1. The time now is 02:36 AM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"