Solved

Open Excel from a Dialog's button.

Posted on 2004-10-20
9
204 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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Suggested Solutions

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.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

760 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

20 Experts available now in Live!

Get 1:1 Help Now