Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Calling Excel macro commands from Matlab

Subject: Calling Excel macro commands from Matlab

From: Conrad

Date: 15 Sep, 2009 16:39:02

Message: 1 of 2

Hi, I have the following excel Macro:
    Range("F1:F18").Select
    With Selection.Borders(xlEdgeLeft)
        .LineStyle = xlContinuous
        .Weight = xlThin
        .ColorIndex = xlAutomatic
    End With
    With Selection.Borders(xlEdgeRight)
        .LineStyle = xlContinuous
        .Weight = xlThin
        .ColorIndex = xlAutomatic
    End With
It basically draws 2 vertical lines in a table.

I am aware that it's possible to run an excel macro from within Matlab but can I use Matlab commands to draw these vertical lines without having to call a macro?

Thanks for your help!

Subject: Calling Excel macro commands from Matlab

From: Rune Allnor

Date: 15 Sep, 2009 16:51:34

Message: 2 of 2

On 15 Sep, 18:39, "Conrad " <conr...@gmx.net> wrote:
> Hi, I have the following excel Macro:
>     Range("F1:F18").Select
>     With Selection.Borders(xlEdgeLeft)
>         .LineStyle = xlContinuous
>         .Weight = xlThin
>         .ColorIndex = xlAutomatic
>     End With
>     With Selection.Borders(xlEdgeRight)
>         .LineStyle = xlContinuous
>         .Weight = xlThin
>         .ColorIndex = xlAutomatic
>     End With
> It basically draws 2 vertical lines in a table.
>
> I am aware that it's possible to run an excel macro from within Matlab but can I use Matlab commands to draw these vertical lines without having to call a macro?

Well... don't know if this qualifies as 'matlab commands',
but you can use matlab to issue commands to excel to do what
you want.

The problem is how to map the commands in the VBA macro over
to something that cam be issued to excel from matlab via the
COM interface.

Rune

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us