Open and excel file w/ command button?

kalebson

Registered User.
Local time
Yesterday, 19:30
Joined
Sep 27, 2006
Messages
38
I am trying to open a workbook with a command button on a form however the path to the file is giving me a fit. The path for the file location contains spaces and I am going blind trying to figure out how to rectify the path. Heres the line. I am sure someone here will see this problem quick! Thanks.

Private Sub Command0_Click()
On Error GoTo Err_Command0_Click

Dim stAppName As String

stAppName = "Excel.exe N:\OPS\COMMON\OpsResearch\Contact Center\DI CCL Reporting dB\Apps by Agent.xls"
Call Shell(stAppName, 1)

Exit_Command0_Click:
Exit Sub

Err_Command0_Click:
MsgBox Err.Description
Resume Exit_Command0_Click

End Sub

Heres the mess I made out of it:
stAppName = "Excel.exe N:\OPS\COMMON\OpsResearch\Contact" & Chr(32) & "Center\DI" & Chr(32) & "CCL" & Chr(32) & "Reporting" & Chr(32) & "dB\Apps" & Chr(32) & "by" & Chr(32) & "Agent.xls"""

:confused:
 
I'm having a similar problem and would be interested to know where i'm going wrong. I keep getting the message "file not found". I know very little about this sort of thing and was wondering if anyone can see anything wrong with my code:

Private Sub Command0_Click()
On Error GoTo Err_Command0_Click

Dim stAppName As String

stAppName = "Word.exe G:\Run Reviews\100Brr\Current.doc"
Call Shell(stAppName, 1)

Exit_Command0_Click:
Exit Sub

Err_Command0_Click:
MsgBox Err.Description
Resume Exit_Command0_Click

End Sub

Any Help would be much appreciated

Thanks
 
Thanks Oldsoftboss :) but what i need is a way of having 1 button linking to the file, not a button to attach and then another button to view. Each link has to be exclusive to that record too.

So basically if i press the "Equipment" button it will go to the current equipment file. I've managed to do this using hyperlinks before but i want the form to look good and so i think buttons are the way forward on this one. Maybe if the hyperlink could be attached to the button it would solve my problem. Not sure if this is possible but i hope someone can help.

Thanks
 

Users who are viewing this thread

Back
Top Bottom