customize right-click context menu in Word 
Author Message
 customize right-click context menu in Word
Hi Denise,

Quote:
> Do you know if such a macro already exists ?
> Do you think I can do this using VBA ?

I don't know if one exists, but I am certain you could
develop this yourself. For me, the main question would be:
What's going to be the most efficient way to deal with the
data source?

I suspect using ADO (rather than automating Excel) to the
spreadsheet data would be fastest. Here's a bit of sample
code, to get you started. There's no error handling, or
what should happen if the term can't be found. You'd need
to set a REFERENCE to a (any) "Microsoft ActiveX Data
objects" library in the Visual Basic editor (via the Tools
menu) so that you can use the ADO objects the code
contains.

Sub GetTermEng()
    Dim conn As ADODB.Connection
    Dim rs As ADODB.Recordset
    Dim szSQL As String

    Set conn = New ADODB.Connection
    conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
           "Data Source=J:\Testfiles\Terms.xls;" & _
           "Extended Properties=""Excel 8.0;HDR=Yes"""
    Set rs = New ADODB.Recordset
    szSQL = _
      "SELECT GermTerm FROM [Sheet1$] WHERE EnglTerm='" _
      & Selection.Text & "'"
    rs.Open szSQL, conn
    Selection.Text = rs.Fields(0).Value
    rs.Close
    Set rs = Nothing
    conn.Close
    Set conn = Nothing

End Sub

Cindy Meister
INTER-Solutions, Switzerland
http://www.*-*-*.com/
http://www.*-*-*.com/
http://www.*-*-*.com/

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



Wed, 18 May 2005 22:50:02 GMT  
 customize right-click context menu in Word
Hi Cindy,

The sample code you sent me works perfectly and runs fast.
This is really great :-)

I'll add some code for error handling and configuation
settings (glossary pathname, source and destination
languages, etc.).

Thank you very much !

Denise



Fri, 20 May 2005 07:22:28 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Help Please: Customizing Right-Click Pop-up Context Menu

2. Customizing right click menu of Word

3. Customizing right click menu of Word

4. Right click menu (context menu?)

5. How to customize standard right-click pop-up menu

6. Customizing Right Click Menu

7. customize right-click popup menu

8. Q: Customizing the popup context menus in Word (97 and 2000)

9. Questions on Customized Right-Click Menu and Title Bar

10. Customizing Right Click Menu

11. Q: Customizing the popup context menus in Word (97 and 2000)

12. Right Click Context Menu

 

 
Powered by phpBB® Forum Software