Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: Pass arguments to VBA macro

by marto (Cardinal)
on May 11, 2007 at 09:50 UTC ( [id://614862]=note: print w/replies, xml ) Need Help??


in reply to Pass arguments to VBA macro

Typo:
$word->run("vad", "D:\\Prasad\\Projects\\tools\\vad"');
should be
$word->run("vad", "D:\\Prasad\\Projects\\tools\\vad");

And:
#$word->run("vad")       #running fine
should be:
#$word->run("vad");       #running fine

A working example based on what you have
use strict; use warnings; use Win32::OLE; use Win32::OLE qw(in with); use Win32::OLE::Const 'Microsoft Word'; $Win32::OLE::Warn = 2; # Throw Errors, I'll catch them my $word = Win32::OLE->GetActiveObject('Word.Application') || Win32::OLE->new('Word.Application', 'Quit'); #get the word ++object $word->Documents->Add || die("Unable to create document ", Win32::OLE- +>LastError()); $word->run("test", "D:\\Prasad\\Projects\\tools\\vdd");
With a word macro:
Sub test(teststring as String) MsgBox(teststring) End Sub
Works as expected

Update: Removed redundant br tag

Martin

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://614862]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (4)
As of 2024-03-19 04:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found