button in Word to open another document

  • Thread starter doug depker via OfficeKB.com
  • Start date
D

doug depker via OfficeKB.com

I am trying to create a button in a document I have. I want it to link to
another file on my hard drive. I have not used VB in years and do not
remember the commands I need to type in.
 
H

Helmut Weber

Like this
Documents.open "c:\test\test.doc"


Greetings from Bavaria, Germany

Helmut Weber, MVP, WordVBA

Win XP, Office 2003
"red.sys" & Chr$(64) & "t-online.de"
 
D

doug depker via OfficeKB.com

What is the entire code? I am trying to make a two buttons, one that says
Contacts and the other says Procedures. What is the entire code from Sub
Test to End Sub?
Thanks
 
H

Helmut Weber

Hi,

View, toolbars, control toolbox.
Insert your commandbutton.
Right mouse click, viewcode:
Make the code look like this:

Private Sub CommandButton1_Click()
Documents.Open "c:\test\word\testlong.doc"
End Sub

Exit design mode.
I am trying to make a two buttons,
one that says Contacts and the other says Procedures.

?

Think we got a language problem here.


Greetings from Bavaria, Germany

Helmut Weber, MVP, WordVBA

Win XP, Office 2003
"red.sys" & Chr$(64) & "t-online.de"
 
D

doug depker via OfficeKB.com

Thank you that was what I was looking for. How do I change the name of the
button?
 
D

doug depker via OfficeKB.com

How do I enable macros in Word. I made the button in some of the other
documents, however in some of the word docs the button won't execute. In VB
it says I need to enable macros in the host application.
 
H

Helmut Weber

Hi Doug,

start a new thread, or google.

There have been a lot of postings about macros,
that can't be executed because of security settings.

It's only that I can't test it.

Someone here will know, for sure.


Greetings from Bavaria, Germany

Helmut Weber, MVP, WordVBA

Win XP, Office 2003
"red.sys" & Chr$(64) & "t-online.de"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top