?
Solved

Open Excel from a Dialog's button.

Posted on 2004-10-20
9
Medium Priority
?
244 Views
Last Modified: 2013-11-20
I'd like to ask , how to open an excel file using the actual excel application
from a clicked button on a dialog.

Thank you.
0
Comment
Question by:colossus_21
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
9 Comments
 
LVL 2

Accepted Solution

by:
raed_hasan earned 500 total points
ID: 12356043

To open Excell (or any registered file type) You can use
ShellExecute(HWND hParent, "open", PathName, NULL, NULL, SW_SHOWNORMAL);


Regards
0
 

Author Comment

by:colossus_21
ID: 12356555
I tried ShellExecute before but I cannot , open other text files on excel.
I was able to open an an ordinary text file using WinExec, but I don't know the exact
option how to resize a column when opening an ordinary text file.

0
 
LVL 12

Expert Comment

by:OnegaZhang
ID: 12356647
if you want to use automation, here are some code snippets
www.fruitfruit.com/vc/activex/excelauto.cpp
0
Percona Live Europe 2017 | Sep 25 - 27, 2017

The Percona Live Open Source Database Conference Europe 2017 is the premier event for the diverse and active European open source database community, as well as businesses that develop and use open source database software.

 
LVL 2

Expert Comment

by:raed_hasan
ID: 12361324
Text files would be opened with NotePad.  Excel files (.xls) are not text files. Forget
that WinExec exists, you should not use it for anything. The concept of "column" does not
exist with respect to text files.

Do you mean you want to open a text file in Excel? If so, you would probably use use
CreateProcess.  But if you need to resize columns, you need to invoke Excel using its
ActiveX or similar COM interface, and that's a whole different question.
0
 

Author Comment

by:colossus_21
ID: 12365104
Using TAB I can write individual string from a text file on one column
of excel. what I just want to know is how to display the whole string
on one column, which I think I have to resize the column for that string to
appear. I just want to know the exact character for that.
0
 
LVL 2

Expert Comment

by:raed_hasan
ID: 12378813
The problem is that you are talking about a tab-delimited-text input file. There are, as
far as I know, no magic commands that resize the columns when reading a file of this type.
Invoking Excel as a COM object, however, gives you complete control over everything; the
downside is that you have to learn how to do it (I've found the Microsoft docs on this
largely inpenetrable)
0

Featured Post

[Webinar] How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
Suggested Courses
Course of the Month9 days, 13 hours left to enroll

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question