ShellExecute with VB6
ShellExecute with VB6
ShellExecute with VB6
ShellExecute with VB6
ShellExecute with VB6
ShellExecute with VB6 ShellExecute with VB6 ShellExecute with VB6 ShellExecute with VB6 ShellExecute with VB6 ShellExecute with VB6 ShellExecute with VB6 ShellExecute with VB6
ShellExecute with VB6 ShellExecute with VB6
ShellExecute with VB6
Go Back  Xtreme Visual Basic Talk > > > ShellExecute with VB6


Reply
 
Thread Tools Display Modes
  #1  
Old 01-29-2018, 09:18 AM
drneilmartin drneilmartin is offline
Newcomer
 
Join Date: Jan 2018
Posts: 1
Default ShellExecute with VB6


I am trying to use ShellExecute to automatically open an RTF file (in Word) or CSV file (in Excel). I have Office 365 (2016) installed. I am using the following code which works for RTF files, but not for CSV files which open in NotePad even though double-clicking on a CSV file opens in Excel.

Dim hWnd

ShellExecute hWnd, "edit", dfile, vbNullString, vbNullString, 1

If I use 'open' instead of 'edit', RTF files still open in Word, but CSV files cause Excel to open but not display the file, and not even a new/blank worksheet... I have been scratching my head about this for a while... Any ideas?

Thanks
Reply With Quote
  #2  
Old 02-08-2018, 09:18 AM
Daigon Ali Daigon Ali is offline
Regular
 
Join Date: Aug 2014
Location: London
Posts: 73
Default

Hi,

I haven't been able to replicate this.
I did experience the same behaviour with Office 365 Excel 2016 when double-clicking a file to open it. This was resolved by completing a repair.

Does the same thing happen if it's an Excel file extension rather than a CSV?
Reply With Quote
  #3  
Old 02-08-2018, 07:44 PM
Kluz's Avatar
KluzShellExecute with VB6 Kluz is offline
Sapience.Aquire

Super Moderator
* Expert *
 
Join Date: Oct 2003
Location: Lake Bluff, Ill., U.S.
Posts: 3,461
Default

Your local comp settings probably have Notepad as the default app for .csv. I would automate Excel and Word directly since you cannot control what an end user's settings are.
__________________
No the other right mouse click
Reply With Quote
  #4  
Old 02-09-2018, 02:11 AM
Daigon Ali Daigon Ali is offline
Regular
 
Join Date: Aug 2014
Location: London
Posts: 73
Default

Quote:
Your local comp settings probably have Notepad as the default app for .csv
Maybe, but he says that double-clicking the CSV file opens it in Excel and, using the "Open" parameter, Excel does launch but fails to load anything.

It would be interesting to see if automating Excel resulted in the CSV file being loaded successfully.
Reply With Quote
  #5  
Old 04-18-2018, 10:50 PM
fafalone fafalone is offline
Freshman
 
Join Date: May 2010
Posts: 38
Default

Well, if it's not the default you could use association invokers...

I have a demo that shows the open with menu for a file to use invoke handlers to open it with any program it's associated with...


See here.

(can we not embed images? attaching)
Attached Images
File Type: jpg dWnHs2x.jpg (30.2 KB, 1 views)
Reply With Quote
Reply

Tags
csv, file, files, shellexecute, excel, rtf, edit, vbnullstring, hwnd, word, ideas, scratching, head, new/blank, worksheet, display, installed, office, automatically, code, dim, double-clicking, vb6, notepad, dfile


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
ShellExecute with VB6
ShellExecute with VB6
ShellExecute with VB6 ShellExecute with VB6
ShellExecute with VB6
ShellExecute with VB6
ShellExecute with VB6 ShellExecute with VB6 ShellExecute with VB6 ShellExecute with VB6 ShellExecute with VB6 ShellExecute with VB6 ShellExecute with VB6
ShellExecute with VB6
ShellExecute with VB6
 
ShellExecute with VB6
ShellExecute with VB6
 
-->