Control Box help - visual basic

  • Thread starter Thread starter jontait
  • Start date Start date
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
 
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
 
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
 

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

Back
Top