A Microsoft Word forum. Microsoft Office Word Forum - WordBanter

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 » Microsoft Office Word Forum - WordBanter forum » Microsoft Word Newsgroups » Microsoft Word Help
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Using the environ function in a world field



 
 
Thread Tools Display Modes
  #1  
Old July 31st 12, 12:32 PM
DanMurphy DanMurphy is offline
Junior Member
 
First recorded activity by WordBanter: Jul 2010
Posts: 1
Default Using the environ function in a world field

Hello All

I am using Word 2007, and trying to make a word template with a users signature automatically present depending on the user that opens the document.

I am having little success at the moment however, I am brutishly inexperienced with Word VBA.

My first attempt was a straightforward inclusion in the word fields

{INCLUDEPICTURE C:\\Signatures\\Environ("Username").bmp}

which returned a broken picture symbol.

My second attempt has been to have a wrapper function around it.

Public Function EMPNAME()

EMPNAME = Environ("Username")

End Function

But including
{INCLUDEPICTURE C:\\Signatures\\{=EMPNAME()}.bmp}

Just returns syntax error.


Could anyone point me in the right direction? It would be greatly appreciated.
Ads
  #2  
Old July 31st 12, 07:28 PM posted to microsoft.public.word.docmanagement
Stefan Blom[_3_]
external usenet poster
 
Posts: 6,575
Default Using the environ function in a world field

The Environ function can be used, from within Visual Basic for Applications, to
return paths represented by environment variables. It can't be embedded in a
field code.

--
Stefan Blom
Microsoft Word MVP




"DanMurphy" wrote in message news

Hello All

I am using Word 2007, and trying to make a word template with a users
signature automatically present depending on the user that opens the
document.

I am having little success at the moment however, I am brutishly
inexperienced with Word VBA.

My first attempt was a straightforward inclusion in the word fields

{INCLUDEPICTURE C:\\Signatures\\Environ("Username").bmp}

which returned a broken picture symbol.

My second attempt has been to have a wrapper function around it.

Public Function EMPNAME()

EMPNAME = Environ("Username")

End Function

But including
{INCLUDEPICTURE C:\\Signatures\\{=EMPNAME()}.bmp}

Just returns syntax error.


Could anyone point me in the right direction? It would be greatly
appreciated.




--
DanMurphy

 




Thread Tools
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
What is Word msg "check temp environ variable? How fix? McNutt1870 Microsoft Word Help 2 April 5th 10 03:35 PM
What is Word msg "check temp environ variable? How fix? McNutt1870 Microsoft Word Help 0 April 5th 10 03:30 PM
How do I get the overstrike field code (Eq \o) to function? WillyDee Microsoft Word Help 4 December 31st 07 04:20 PM
using DateAdd function in a Word form field lsnoble Microsoft Word Help 3 November 5th 06 10:26 AM
Inserting a field function. srjaneiro Microsoft Word Help 1 April 20th 05 04:01 PM


All times are GMT +1. The time now is 12:59 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Copyright ©2004-2013 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.