Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


'variable is undefined' runtime error

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,64580
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> 'variable is undefined' runtime error
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 'variable is undefined' runtime error - 9/25/2008 8:51:14 PM   
  meerkat

 

Posts: 16
Score: 0
Joined: 9/21/2008
Status: offline
Hi,
I am a newbie and am getting the above error for the object 'PeachtreeAccounting' when I run the following code.

Dim Login
Set Login = CreateObject("PeachtreeAccounting.Login.16")
Dim App
Set App = Login.GetApplication("COMPANY NAME", "M48FT9X2A")
Dim CustomerExporter
Set CustomerExporter = PeachtreeAccounting.Export     ********* this is the line on which I get the error*********************
CustomerExporter = App.CreateExporter(PeachtreeAccounting.PeachwIEObj.peachwIEObjCustomerList)

I should explain that PeachtreeAccounting is an accountancy package; in order that I  can export their data I create a login object which starts up the application. That part works; I run the script and the package opens. Peachtree say I should have to register no more files because the relevant files are exposed through the application.

I have googled this and the solution mainly seems to be misspellings (which I have checked) or the fact that Option Explicit is turned on. The latter is true but as this exerpt is part of another script which I am not allowed to alter, that solution is not possible.

As 'PeachtreeAccounting.Export' is an object, I assume I have to treat it differently to declaring a variable, but how?

I would be grateful if anyone could point me in the right direction.

meerkat
 
 
Post #: 1
 
 RE: 'variable is undefined' runtime error - 9/25/2008 9:26:22 PM   
  meerkat

 

Posts: 16
Score: 0
Joined: 9/21/2008
Status: offline
By the way, when I do try adding a 'Dim PeachtreeAccounting' I get the error 'object required'. The object should be there according to Peachtree.

(in reply to meerkat)
 
 
Post #: 2
 
 RE: 'variable is undefined' runtime error - 9/26/2008 2:37:02 AM   
  ehvbs

 

Posts: 2169
Score: 50
Joined: 6/22/2005
From: Germany
Status: offline
Hi meerkat,

not knowing anything about Peachtree, I may be wrong, but I'd try

Dim Login
Set Login = CreateObject("PeachtreeAccounting.Login.16")
Dim App
Set App = Login.GetApplication("COMPANY NAME", "M48FT9X2A")
Dim CustomerExporter
Set CustomerExporter = App.CreateExporter( App.PeachwIEObj.PeachwIEObjCustomerList )
CustomerExporter.Export

assuming that .Login gives you an application and the application gives you
everything else.

If you can use Excel, you can add a references to your Peachtree .dll to a module
and use the object browser to lookup objects, methods, and properties.

Good luck!

ehvbs

(in reply to meerkat)
 
 
Post #: 3
 
 RE: 'variable is undefined' runtime error - 9/26/2008 3:21:05 AM   
  meerkat

 

Posts: 16
Score: 0
Joined: 9/21/2008
Status: offline
Hi ehvbs,
Thanks again for your help.
When I try your suggestion I get the error msg 'Object doesn't support this property or method: App.PeachwIEObj' which sounds like it can't find the COM object.

I have checked the registry and can find no object called PeachtreeAccounting.Export though I did find PeachtreeAccounting.Login.16 which is the one I created.  I assume I should be able to find the Export object if I am supposed to be referring to it?

I have referred back to Peachtree for now.

Thanks again,

meerkat

(in reply to ehvbs)
 
 
Post #: 4
 
 RE: 'variable is undefined' runtime error - 9/29/2008 8:40:46 PM   
  meerkat

 

Posts: 16
Score: 0
Joined: 9/21/2008
Status: offline
Hi ehvbs,

I've decided to go down the route of wrapping the export function in a .NET dll and instantiating it from within my VBscript program. The VBscipt program is simply not picking up the objects provided by Peachtree.

Thanks anyway for your help.

meerkat

(in reply to meerkat)
 
 
Post #: 5
 
 RE: 'variable is undefined' runtime error - 10/9/2008 2:37:45 AM   
  meerkat

 

Posts: 16
Score: 0
Joined: 9/21/2008
Status: offline
For future reference, the solution to this problem was to use enumerated values instead of written objects.
These can be provided by Peachtree.

(in reply to meerkat)
 
 
Post #: 6
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> 'variable is undefined' runtime error Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts