Welcome to WEAP's Website WEAP
WEAP is an initiative of the Stockholm Environment Institute.

About WEAP

What's New?
Sample Screens
History and Credits

Using WEAP
User Guide
Videos (YouTube)

User Forum
Members List
Edit Profile

Additional Support
University Courses

About Us
SEI-US Water Resources Program
Please Contact Us

Environmental News
Not acting like themselves: Antidepressants in environment alter crayf...
Expose crayfish to antidepressants, and they become more outgoing -- but that might not be such a positive thing for the...

Heat from below: How the ocean is wearing down the Arctic sea ice
The influx of warmer water masses from the North Atlantic into the European marginal seas plays a significant role in th...

Research reveals why people pick certain campsites
Those in love with the outdoors can spend their entire lives chasing that perfect campsite. New research suggests what t...
Source: Science Daily
Interested in Energy?
Read about LEAP: SEI's software for energy planning.

Link WEAP and LEAP for combined Water-Energy planning.
Watch a video demo!

User Forum

All Topics | Topic "Using ReadFromFile from the API"
Log in to post new messages or reply to existing messages.
Author Message
Mr. Jack Johnson

Subject: Using ReadFromFile from the API   
Posted: 3/21/2017 Viewed: 7187 times

I'm currently needing to import a large amount of variables into one of my models. As such I'm trying to get to grips with the API. Currently using VBScript as my approach although I'm open to alternatives.

I'd like to use the ReadFromFile function to import my data.

Within WEAP I've successfully ran this to import data to one of my river headflows:

ReadFromFile("D:/TEMP(WEAPDATA)/Example_Flow.csv", Flow, , Sum)

However, when I try to call that out of the Immediate VB window in Excel using:

W.Branch("\Supply and Resources\River\KEG_River_26").Variables("Headflow").Expression = ReadFromFile("D:/TEMP(WEAPDATA)/Example_Flow.csv", Flow, , Sum)

I hit an error:

Compile error: Sub or Function not defined.

Would anyone be able to offer advice on this? The main question being am I trying to use ReadFromFile correctly out of Excel. I couldn't find an example of this in the manual but I did find variables being set to values e.g. ...Expression = 30 which I have been able to replicate.

Topic "Using ReadFromFile from the API"