Help with command button!

ladivapr

Registered User.
Local time
Today, 20:27
Joined
Jul 15, 2003
Messages
28
I want a command buttom that opens a specific excel file. I dont know how to do this. Most I can do is open the excel application with the command wizard and thats about it. Please help guys! Somebody suggested me this code to put on the onclick field of the buttom:

Application.FollowHyperlink "C:\Documents and Settings\Template.xls", , True, True


But it doesnt seem to work. Help!

diva
 
Either of these should work...

Application.FollowHyperlink "C:\Documents and Settings\Template.xls"

Call Shell("C:\Program Files\Microsoft Office\Office\Excel.exe C:\Documents and Settings\Template.xls", vbMaximizedFocus)

The Shell command does not like it when the file or paths have a space in between.

I think your problem was all the extra commas at the end of your command. Also, does the "Template.xls" file really exist @ C:\Documents and Settings\ ? You should use the Dir() function to test if the file exists. Check the help files for the Dir() function or search this forum for examples.

HTH
 
I use the following to open an Excel spreadsheet:

(The file path is stored in the Db as a text field called Me.QuoteWorkout)

Dim XL As Object
Set XL = CreateObject("Excel.Application")

If IsNull(Me.QuoteWorkout) Then
MsgBox "You haven't Attached a Calculation File", , " Service Operations"
Else

With XL.Application
.Visible = True
.workbooks.Open Me.QuoteWorkout

End With

Set XL = Nothing

End If
 
Last edited:
And to open a Word document.

(The file path is stored in the Db as a text field called Me.QuoteDocumentPath)

Dim objword As Object
Set objword = CreateObject("Word.Application")

objword.Visible = True
objword.Documents.Open (Me.QuoteDocumentPath)

HTH

Dave
 

Users who are viewing this thread

Back
Top Bottom