Shortcut Code PLEASSSSEEE

Experts,
I'm having trouble running a shellexecute in vb6.3.  I'm simply trying to open the following shortcut:
    D:\Documents and Settings\yzhjhys\Desktop\batch.lnk  
    which targets:  C:\byers\ewo\batchbr.exe \bst\ewo\cfg\cdconfig.dbf   which starts in:  C:\byers\ewo

Can someone please help with the syntax, the full code I need to use to call the shortcut.  If I key in the actually .exe, it attempts to open but is looking for the above \bst\ewo\cfg\cdconfig.dbf and sends back an error; However, only by opening the shortcut will the program run correctly.

Code please.
 
PAMMIEOAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

ajgilbertCommented:
Here you go....

Public 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

Public Function OpenLink(ByVal FileN As String, Optional CommandLine As String = "") As Long
OpenLink = ShellExecute(0&, "Open", FileN, CmdL, vbNullString, 1)
End Function

Private Sub Command1_Click()
Dim lnkFile As String
lnkFile = "D:\Documents and Settings\yzhjhys\Desktop\batch.lnk"
OpenLink lnkFile
End Sub

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
PAMMIEOAuthor Commented:
Very Simple, I cut and paste. Thanks.  I can post as another question for points if you like for this complex question.
When I try to run in VB, it takes me to the macro screent o select a macro in my list at which point I can enter a new macro name and create or select a macro from the existing list.  Also, I want to execute the above command on a mouse click from a command button.  Let me know is you want me to post as a question for points. Thanks
ajgilbertCommented:
Pammieo,


Sorry for not replying sooner, but I've been away on holiday...


I'm not too sure what you mean in the first point in your question. Are you running the above code in VB or in VBA ?

If you place a command button on your form, and then add the code above, it will run when you click the button.



PAMMIEOAuthor Commented:
AJGILBERT

HERE IS ANOTHER QUESTION I POSTED. WOULD YOU MIND TAKING A LOOK AT IT.

Reverenced Experts,
I am attempting to within the current database import a .dbf file once it is added to a directory on my local drive and then pull the data into a table and then a standard report format within the current db.  So, if the current db filename is "Processor", the .dbf file will be located in the same directory everytime called "c:\datafiles\" while the folder and dbf file to import will be "parameter\parameter.dbf" changing each time the dbf file is downloaded by an external vendor autoexec process, the afore mentioned parameter will come from a form within the current database called "Retriever Form" in a text object called "text1" which will be keyed by the user each time.  

Will you help me create a code that will take all this info and:
1.  Automatically notify a new .dbf file is in the c:\datafiles\ directory regardless of the subfolder name and dbf filename.
2.  Once notified, I want to have the option to click on the "Process" button to import it into the current db or the "Cancel" button option to not import.
3.  Lastly, once imported, I would like to be able to generate standard reports for the newly imported dbf or have a drop option to select newly imported dbf which is now in a table format to populate the report -- whichever is less complex.
4.  FYI, once the tables are created, I want to keep the data; therefore, I want need to delete the table once imported and report generate.
5.  Also, not necessary, but once the report is generated, I would like a tab on the report screen that will allow me to Print the report or Email the report.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.