can any one help me in the following problem

i have created a exe file in visual basic. in my application if i click a command box a excel file will open. the excel file is accessible in my system. but if the exe file is executed in any other pc the user is unable to access the excel.

pls help.........

there are some error display when you execute that exe file??

there are some error display when you execute that exe file??

yes i got some error. the error displayed is given below

"Run-time error '1004':

"path of file name" not found. Check the spelling of the file name, and verify that the location is correct.
If you are trying to open the file from your list of most recently used files on the File menu, make sure that the file has not been renamed, moved, or deleted"

This is the error am getting.

can u understand my question. pls reply if u cant understand my question.

can any one help me in the following problem

i have created a exe file in visual basic. in my application if i click a command box a excel file will open. the excel file is accessible in my system. but if the exe file is executed in any other pc the user is unable to access the excel.

pls help.........

the error you are facing is because you haven't copied the excel file from your pc to the destination pc and of course you might have specified the physical path of the file in your code which may or may not be exist in your target pc. the solution for your problem is, make sure you have copied both the exe and excel files to your target pc and try to avoid fixing paths in your code. instead of it always use the same path as your project directory and store all of your dependent files inside the folder from where you are running the exe file.

though you have not specified here in which way you have made your program files available in the target pc (whether just simple copied the files from ur pc and paste them inside a folder in the target pc or you have built a setup package for your project to install all files in the target pc), it is always recommended that you must create an installer for your project before running your application in some other computer where vb6 is not installed. so if you create an installer make sure you have also included all dependent files for your project (in this case the excel file you are trying to open) in your setup package.

here is a sample snipper for you. try it and plz give me some feedback here.

declare this function in your form's general declaration section. this will open the specified file in its default associated application.
Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long

Private Sub Command1_Click()
Call ShellExecute(Me.hwnd, [B]"open"[/B], [B]App.Path & "\school.xls"[/B], vbNullString, vbNullString, vbMaximizedFocus)
End Sub
look at the parameters inside the function mark as bolded. here "open" is used to specify that some file should be opened when this function will be fired. the parameter just follwed it is the complete physical path of the file you wish to open. here i mentioned app.path, that means the program will look for the file in the same folder where the exe resides. now you can change this path to the location from where you are trying to open your excel files.

hope this solves your problem.

regards
Shouvik

maybe your path in code is wrong?
i mean your path not same in other pc or the excel file is not exist in other pc.
do like as shouvik said.

Thanks choudhuryshouvi,

I will try it and i will get back to you. i need to reinstall my vb as my PDW is not working properly

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.