CALLING EXTERNAL DOCS

P

Peter KNAP

Hi.
How could I call external document to open with macro after selecting
macrobutton in userform?
I need to have four slightly different templates of document with
differencies only in number of active substances what will cause to use of
diggerent userforms and different documents.
small difference at the beginnign, big difference at the end.
could somebody help?
Thanks
Peter
 
G

Graham Mayor

It would probably better to have the one template and insert the varying
texts as appropriate eg at its simplest a user prompt asks for Document1, 2
or 3 and inserts it at bookmark Text1, 2 or 3

Dim sText As String
Dim sPath As String
Dim iNum As Integer
sText = "D:\My Documents\Word Documents\Document"
iNum = InputBox("Enter 1, 2 or 3", "Choose document")
sText = sText & iNum & ".doc"
MsgBox sText
With Selection
.GoTo What:=wdGoToBookmark, name:="Text" & iNum
.InsertFile FileName:=sText
End With

You could instead insert a series of suitably named autotexts which could be
stored in the template for ease of access, or simply use conditional fields
to insert the appropriate data.

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 

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