Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / April 2005

Tip: Looking for answers? Try searching our database.

Need help with howto choose logo at start word doc

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
N. Mulder - 11 Apr 2005 09:56 GMT
Hello, my problem is as follows.
When a user starts a word document i want they can choose which logo to use,
so it automaticly places the righht logo in the top of the document.

Now this will work with the ASK fieldcode together with the INCLUDEPICTURE
fieldcode. But since the numbe of logo's is increasing this way won't work
anymore because in the questionfield in de ASK fieldcode I will ask the user
which logo the want to use. So it will be like:

{ ASK logo "Give a 1 to display logo 1, a 2 to display logo 2... etcetc" \*
MERGEFORMAT }{ IF { REF Logo } = "1" "{ INCLUDE PICTURE "c:\\temp\\logo1.jpg"
\* MERGEFORMAT }" "{ IF { REF Logo } = "2" "{ INCLUDE PICTURE
"c:\\temp\\logo2.jpg" \* MERGEFORMAT }" "etcetc" }

This is working though, but in the question area of the ASK fieldcode a max
number of characters is allowed, and a really long text explaining what
number to press to display a logo is not really user friendly.

Now my question is how to solve my 'problem' in a user friendly way. This
"logo choosing part" will be implemented in many documents.

I've thought about another method and I was thinking about when Word starts
a window will popup which list al the logo's available (they are in the same
folder) and then the user only has to click on the logo he wants. But i have
no idea if this is possible and how to make this.

Hope someone will help me out with this.

Many thanks in advance.
Jay Freedman - 11 Apr 2005 15:55 GMT
You can investigate the idea of a userform launched from an AutoNew macro,
described in http://word.mvps.org/FAQs/Userforms/CreateAUserForm.htm.
Instead of placing text controls in the userform, you can have a list box
for the user to select the desired logo. Then the code of the OK button can
insert the corresponding INCLUDEPICTURE field in the document.

Another alternative is to store the logos as AutoText entries in the
template, and use an AutoTextList field in the document
(http://word.mvps.org/FAQs/TblsFldsFms/AutoTextList.htm).

Signature

Regards,
Jay Freedman
Microsoft Word MVP          FAQ: http://word.mvps.org

> Hello, my problem is as follows.
> When a user starts a word document i want they can choose which logo
[quoted text clipped - 29 lines]
>
> Many thanks in advance.
N. Mulder - 12 Apr 2005 10:14 GMT
Thxs for your response! But how can I insert a field into the document?
Because when i insert the includepicture field as a string into the document,
it will just be text and no field.

> You can investigate the idea of a userform launched from an AutoNew macro,
> described in http://word.mvps.org/FAQs/Userforms/CreateAUserForm.htm.
[quoted text clipped - 39 lines]
> >
> > Many thanks in advance.
N. Mulder - 12 Apr 2005 11:50 GMT
I findout myself with the following code:

Const wdQuote = """"

strFileName = lbxList.Value
strDirName = "L:\CCS\word\Logo\"
strDirFileName = strDirName + strFileName
strDirFileName = Replace(strDirFileName, "\", "\\")

If Len(strDirFileName) > 0 Then
   ActiveDocument.Fields.Add _
   Range:=Selection.Range, _
   Type:=wdFieldIncludePicture, _
   Text:=wdQuote & strDirFileName & wdQuote, _
   preserveformatting:=False
End If

But how can i place the logo where i want? Because now it will be inserted
where the cursor is.

Thanks again for your help!

> Thxs for your response! But how can I insert a field into the document?
> Because when i insert the includepicture field as a string into the document,
[quoted text clipped - 43 lines]
> > >
> > > Many thanks in advance.
Jay Freedman - 12 Apr 2005 14:55 GMT
The first argument in the ActiveDocument.Fields.Add statement is called
"Range", and it represents the place where the field is inserted. The way
you wrote it, Range:=Selection.Range, means that the field is inserted
wherever the cursor (the Selection) is. But you can tell it to use any other
location in the document.

Just like in the article on mvps.org, put a bookmark named Logo in the
template at the location where you want the logo to appear. Then tell the
ActiveDocument.Fields.Add statement to insert the field there by using this
line instead of the one you have now:

 Range:=ActiveDocument.Bookmarks("Logo").Range, _

Signature

Regards,
Jay Freedman
Microsoft Word MVP          FAQ: http://word.mvps.org

> I findout myself with the following code:
>
[quoted text clipped - 72 lines]
>>>>
>>>> Many thanks in advance.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.