Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > VB Script

Vista - Re: Calling excel function

Reply
 
Old 07-29-2009   #1 (permalink)
ekkehard.horner


 
 

Re: Calling excel function

Wolf Grossi schrieb:
Quote:

> Hi folks,
>
> having my first experience with Microsoft Office Excel 2007 and
> VisualBasic, I'm running into the folowing problem:
>
> Script test1.vbs opens TEST1.xls.
> In test1.vbs I want to execute the excel function GenX:
> GenX as listed in Visual Basic Object catalog:
> Public Function GenX(rngData As Range, rootNode As String)
> Element of VBAProject.ConvX
>
>
> test1.vbs:
> ---
> Dim objExcel
> Dim objWorkBook
> Set objExcel = CreateObject("Excel.Application")
> objExcel.Visible = True
> Set objWorkBook = objExcel.Workbooks.Open("C:\TEST1.xls")
> Set objSheet = objWorkBook.ActiveSheet
> Msgbox("excel ActiveSheet=" & objWorkBook.ActiveSheet.Name)
> objExcel.ConvX.GenX objExcel.Range("$A1:$q333"), "formX"
> objExcel.Quit()
> ---
>
> The line 'objExcel.ConvX.GenX ...' throws an error and I have no idea of
> how to call the fuction 'GenX'
>
> - How can I call the function GenX?
> - What is the correct syntax to do so?
>
> If I use 'VBAProject.ConvX.GenX ...'
> it throws the error 'Object required VBAProject'.
> - Do I have to create an object out of VBAProject?
>
>
>
> Thanks for reading and hints!
> Wolf
Use the Excel/VBA Docs to check the .Run method and try:

objExcel.Run "GenX", objExcel.Range("$A1:$q333"), "formX"


My System SpecsSystem Spec
Old 07-29-2009   #2 (permalink)
OldDog


 
 

Re: Calling excel function

On Jul 29, 8:27*am, Wolf Grossi <w...@xxxxxx> wrote:
Quote:

> [snip]
>
>
>
Quote:

> > * objExcel.Run "GenX", objExcel.Range("$A1:$q333"), "formX"
>
> Many thanks! you saved my afternoon
>
> Have a nive day
> Wolf
Out of curiosity, what does GenX do?

OldDog
My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
Re: Calling function from script PowerShell
Call depth reached when calling function PowerShell
Calling Excel PMT from VBScipt vs. PowerShell... PowerShell
Problems calling a function PowerShell
calling imapi2 function put_MultisessionInterfaces return error Vista General


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46