Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

How do I change the code I have to open an existing excel temple I have saved

Posted on 2004-04-14
6
Medium Priority
?
173 Views
Last Modified: 2010-04-05
I want to open an existing excel template I have so I can enter some values from my database into the active sheet.

  oXL := CreateOleObject('Excel.Application');
  oXL.Visible := True;

  // Get a new workbook
  oWB := oXL.Workbooks.Add;
  oSheet := oWB.ActiveSheet;

How can I change the line oXL.Workbooks.Add for my standard .xls file
0
Comment
Question by:mikelittlewood
[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
  • 3
6 Comments
 
LVL 23

Accepted Solution

by:
Ferruccio Accalai earned 400 total points
ID: 10824166
oxl.WorkBooks.Open('C:\Test.xls');
0
 
LVL 15

Author Comment

by:mikelittlewood
ID: 10824566
ah fantastic ... thought it might be something really easy ... still trying to understand automation, this is only my first attempt  :)
0
 
LVL 15

Author Comment

by:mikelittlewood
ID: 10824602
In fact while I have your attention :)

if I wanted to place my template doc in the same folder as my delphi app, do I still have to use c:\<Filename> or is there a standard string I can use to say "Look in application directory"
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 23

Expert Comment

by:Ferruccio Accalai
ID: 10824817

ExtractFilePath(Application.exename)

Return the path including the backslash so

oxl.WorkBooks.Open(ExtractFilePath(Application.exename) +'Test.xls');
0
 
LVL 15

Author Comment

by:mikelittlewood
ID: 10826732
All works a treat .. thx for your help
0
 
LVL 23

Expert Comment

by:Ferruccio Accalai
ID: 10826959
glad to have helped you :)
0

Featured Post

Tech or Treat!

Submit an article about your scariest tech experience—and the solution—and you’ll be automatically entered to win one of 4 fantastic tech gadgets.

Question has a verified solution.

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

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Suggested Courses

604 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