|
-
Sep 29th, 2000, 04:29 PM
#1
Thread Starter
Hyperactive Member
I have made a program that reads and writes to db's which has the extension ".mdb". Now i tried the code if i changed the extension to ".kom" instead and it still works fine and dandy but they can't open it in msacess unless they say open with ms access. Now i was wondering if there is a way in code to say that ".kom" files have "c:\myico.ico" as an icon and open with "c:\myprog.exe"? I know how to do it manually but have no idea how to do it in code.
Also this is how you can open a file with its default extension.
Code:
Call ShellExecute(Me.hwnd, vbNullString, "C:\happy.txt", vbNullString, vbNullString, 0&)
and here is another way
Code:
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 Const SW_HIDE = 0
Private Const SW_MAXIMIZE = 3
Private Const SW_MINIMIZE = 6
Private Const SW_NORMAL = 1
Call ShellExecute(Me.hwnd, vbNullString, "C:\happy.txt", vbNullString, vbNullString, SW_NORMAL)
Now is there a way to specifiy what program you want the file to be opened it? Like for example instead of having
"C:\mytext.txt" open in notepad maybe i want it to open up in wordpad or ms word. Is there a way to do this?
Thanks!!
-
Sep 29th, 2000, 05:12 PM
#2
If you want to open a file strictly with msaccess use the standard Shell() method.
Code:
Shell "msaccess mydb.mdb", 1
-
Sep 29th, 2000, 05:21 PM
#3
Thread Starter
Hyperactive Member
I am guessing the my.mdb would have to be the path of the file so i put
Code:
Shell "msaccess c:\mydb.mdb", 1
i tried it without the c:\ and i still got the same error. file not found. Any siggestions? The reason I have to say open up in access is cause i want it to open
Code:
Shell "msaccess C:\Vocab Info.kom", 1
that in msacess. Thanks
-
Sep 29th, 2000, 05:29 PM
#4
Thread Starter
Hyperactive Member
Alright I am stupids. I got what you meant. You mean this:
Code:
Shell "C:\Program Files\Microsoft Office\Office\MSACCESS.EXE C:\Vocab Info.mdb", 1
Well it works to a degree. When I click the command button it says:
The command line you used to start Microsoft Access contains an option that Microsoft Access doesn't recongnize.
Exit and restart Microsoft Access using valid command-line options.
then when i hit ok ms access comes up and then says:
Msacess can't find the database file 'C:\Vocab.mdb.'
Make sire you entered the correct path and file name.
why the heck does it say Vocab.mdb and not what i entered, which is Vocab Info.mdb? Thanks
-
Sep 30th, 2000, 11:22 AM
#5
Thread Starter
Hyperactive Member
Doesn't anybody know how to make it so that .kom file extension will automatically open up with my program and have a certain icon? Somebody must know. PLease help me!! Oh and it must be in code not manually done because I know how to do it manually. Thanks!!
-
Sep 30th, 2000, 02:50 PM
#6
Addicted Member
Try this:
Code:
------------------------------------------------------------
strAccess = ¡°C:\Program Files\Microsoft Office\Office\Msaccess.exe ¡±
¡®Myfile.mon is an Access file whose extension has been modified
strFileToOpen = ¡°C:\My Documents\Myfile.mon¡±
Shell strAccess & Chr$(34) & strFileToOpen & Chr$(34), vbMaximizedFocus
------------------------------------------------------------
Visual Basic Professional 6.0
-
Oct 2nd, 2000, 10:02 AM
#7
Addicted Member
-
Oct 2nd, 2000, 10:54 AM
#8
Lively Member
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|