Solved

Open Excel from a Dialog's button.

Posted on 2004-10-20
9
210 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
  • 3
  • 2
9 Comments
 
LVL 2

Accepted Solution

by:
raed_hasan earned 125 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
GIF file bit manipulation for color change 5 107
string initialization in java 11 109
tripleUp challenge 7 73
zeroMAx challenge 20 86
Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
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.
A short film showing how OnPage and Connectwise integration works.

930 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

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now