Visual Basic Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreVisual Basic Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here
  #1  
Old June 9th, 2003, 10:22 PM
ofunkym ofunkym is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2003
Posts: 5 ofunkym User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via AIM to ofunkym
Question OLE Automation Excel

I posted a previous thread which asked how to use the Solver add in included in excel in the VB6 environemnt in order to solve an equation with 3 unkowns. In short, I use solver to minimize the sum of the squares.

In thinking about the problem I think I can do this by openning an excel workbook in VB which has the solver included as a recorded macro. I would then dump my data onto the excel workbook and use a shortcut key to launch the solver macro. I am unsure if this will work or how to do this ==> Open an existing file and type the shortcut key in excel without the user being aware of it. Any suggestions would be appreciated.

If you know how to call the solver add in in Excel from a VB6 application that would do as well.

Thanks.

Reply With Quote
  #2  
Old June 9th, 2003, 11:28 PM
mohecan mohecan is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2003
Location: Melbourne, Australia
Posts: 212 mohecan User rank is Private First Class (20 - 50 Reputation Level)mohecan User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
If you write the solver macro, you should be able to "call" the function from your code.

Code:
i.e.
call SolverLaunchMacro
__________________
How can I soar like an eagle when
I'm flying with turkey's?

Reply With Quote
  #3  
Old June 10th, 2003, 07:59 AM
ofunkym ofunkym is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2003
Posts: 5 ofunkym User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via AIM to ofunkym
Ole clarification

I have this macro saved in personal.xls which from my understanding is loaded in the background everytime excel is launched.

If I launch Excel via:

PHP Code:
 Set objXl CreateObject("Excel.Sheet"
Set objXl objXl.Application.ActiveWorkbook.ActiveSheet 


I am assuming I can run this Macro since it should be saved and loaded unto my current instance of Excel. How would I call it from my VB environment? ie Call objxl.Solver_Mac

PHP Code:
 Sub Solver_Mac()

SolverOk SetCell:="$F$1"MaxMinVal:=2ValueOf:="0"ByChange:= 
     
"$E$1,$E$2,$E$3"
    
SolverSolve userfinish:=True
  solverfinish keepfinal
:=1
End Sub 


Thank You

Last edited by ofunkym : June 10th, 2003 at 08:01 AM.

Reply With Quote
  #4  
Old June 10th, 2003, 09:39 AM
ofunkym ofunkym is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2003
Posts: 5 ofunkym User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via AIM to ofunkym
OLE answer

Thanks for the help I was able to call the macro by saving it in personal.xls and using the line:

PHP Code:
 objXl.Application.Run ("personal.xls!Solver_Mac"


All is well.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreVisual Basic Programming > OLE Automation Excel


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

 Free IT White Papers!
 
Accelerating Trading Partner Performance
One in five. That's how many partner transactions have at least one error. That is an amazing statistic, particularly given the extraordinary leaps in innovation across the global supply chain during the past two decades. Download this white paper to learn more.

 
Competing on Analytics
This Tech Analysis is designed to help identify characteristics shared by analytics competitors, and includes information about 32 organizations that have made a commitment to quantitative, fact-based analysis.

 
Cost Effective Scaling with Virtualization and Coyote Point Systems
An overview of the industry trend toward virtualization, how server consolidation has increased the importance of application uptime and the steps being taken to integrate load balancing technology with virtualized servers.

 
Five Checkpoints to Implementing IP Telephony
Implementation planning for IP PBX software and IP telephony has become vital as businesses replace discontinued legacy PBX phone systems. This informative whitepaper outlines five "checkpoints" for any implementation plan that will help make IP communications a successful proposition.

 
Hosted Email Security: Staying Ahead of New Threats
In the last two years, email has become a fierce battleground between the nefarious forces of spam and malware, and the heroes of messaging protection. The spam volumes increased alarmingly every month, bringing clever new forms of phishing and virus propagation attacks.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway