Solved

Open Excel from a Dialog's button.

Posted on 2004-10-20
9
222 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
Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

 
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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

Suggested Solutions

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…
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
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.
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.

770 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