Solved

Open Excel from a Dialog's button.

Posted on 2004-10-20
9
243 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 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
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.
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…

688 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