Control Box help - visual basic

J

jontait

Hi, I'd like some help writing a very simple (to you all, very comple
to me) visual basic code for a control box within my exce
spreadsheet.

I use Excel 97. I know how to place a control box, recolour it etc bu
its the code I'm stuck on.

I would like a user to be able to click on a control box within th
spreadsheet and then for the control box to launch an Acrobat PD
document (or Word), but I've no idea how to write the code.

In this example the file is called "test.pdf" or "test.doc" and i
stored in "c:/excel/"

Thank you very much in anticipation of your help

Jo
 
G

Guest

Try this macro code which sets the target file
as a hyperlink:

Sub Button1_Click()
ActiveWorkbook.FollowHyperlink _
Address:="C:\folder\myfile.doc", _
NewWindow:=True
End Sub

(the space + underline is a line continuation in VBA- the
3lines starting with "Activework..." thru "..:=True"
can be placed all on one line (remove the underline))

jlr
 
J

jontait

Great stuff!

It works really well as it knows straight away which programme open
which file, just what I was after

Thank you so much
 
Top