|
-
Oct 16th, 2000, 08:18 AM
#1
Thread Starter
New Member
I am using shellexecute to launch an excel data file from vb : ret2 = ShellExecute(0&, "OPEN", filename, "", "", 1)
where filename is, for example, "text.xls".
Test.xls is an "!" delimitted text file. The problem is, when excel opens, it bypasses the Text Import Wizard.
I cannot use the Excel object in VB.
2 questions.
1) Once I have a process id (ret2), can I send commands to Excel from VB?
2) Is there anything I can add to the shellexecute command that Excel will recognize so the Import Wizard will show up?
Thanks
-
Oct 16th, 2000, 09:33 AM
#2
Fanatic Member
Use the shell exe API rather than the straight Shell that is available in VB
----------------------------------------------------
Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hWnd As Long, ByVal opOperation As String, ByVal lpFile As String, ByVal opParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
' just call it like this ShellExe("Explorer")
Public Sub ShellExe(What As String)
On Error Resume Next
Call ShellExecute(0&, vbNullString, What, vbNullString, vbNullString, vbNormalFocus)
End Sub
Kurt Simons
[I know I'm a hack but my clients don't!]
-
Oct 16th, 2000, 09:38 AM
#3
Thread Starter
New Member
I'm already using the shellexecute function. What will your code do that mine isn't doing already?
Thanks again.
-
Oct 16th, 2000, 10:09 AM
#4
Fanatic Member
though you might only be using the shell statement that is built into VB.
what happens when you execute the file from the run prompt
c:\text.xls
-------------------------------
ret2 = ShellExecute(0&, "OPEN", filename, "", "", 1)
--------------------------------
try this
ret2 = ShellExecute(0&, vbNullString, filename, "", "", 1)
Kurt Simons
[I know I'm a hack but my clients don't!]
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
|