Hello,
I'm using Eviews 7.2 to try to write some VBA code to write a certain range of Excel Cells into an Eviews workfile.
Here's where I'm at so far:
Sub eviews()
Dim mgr As New EViews.Manager
Dim app As EViews.Application
Set app = mgr.GetApplication(EViews.CreateType.ExistingOrNew)
app.Show
app.ShowLog
app.Run "wfopen K:\non-data-path-folder\workfile.wf1"
app.Run "run K:\non-data-path-folder\Programs\program.prg"
End Sub
The wfopen command seems to be defaulting to the data path and I can't figure how to either temporarily change the data path or allow the command to look for the workfile in a different place.
If I "comment out" the wfopen line, I still cannot get the program to run. Eviews seems almost unresponsive to my attempt. I do not know where I'm misunderstanding the app.run (CommandString) concept.
Thanks for any help or tips.
COM Automation Snag
Moderators: EViews Gareth, EViews Moderator, EViews Jason, EViews Matt
-
EViews Gareth
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13604
- Joined: Tue Sep 16, 2008 5:38 pm
Re: COM Automation Snag
Is there a space in the path? I assume that this isn't the real path:
Code: Select all
K:\non-data-path-folder\workfile.wf1
-
NewbGrammer
- Posts: 3
- Joined: Mon Mar 12, 2012 1:25 pm
Re: COM Automation Snag
Correct, the filepaths above aren't the real ones. There is no space in either filepath, but one folder name is surrounded by parenthesis.
Eg: K:\(folder_name)\programs\program.prg
Eg: K:\(folder_name)\programs\program.prg
-
EViews Gareth
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13604
- Joined: Tue Sep 16, 2008 5:38 pm
Re: COM Automation Snag
The parenthesis are probably causing the problem, and it is probably a problem on our end. Could you try renaming the folder temporarily to see if that fixes it?
Edit: Actually it isn't a problem our end per se. You need to have the path surrounded in quotes whenever you have a parenthesis in the path, in the same way you would if you had spaces.
Edit: Actually it isn't a problem our end per se. You need to have the path surrounded in quotes whenever you have a parenthesis in the path, in the same way you would if you had spaces.
-
NewbGrammer
- Posts: 3
- Joined: Mon Mar 12, 2012 1:25 pm
Re: COM Automation Snag
Ahh that seems to be the issue. Thanks very much for the help. I'll try to get these folder names changed.
-
EViews Steve
- EViews Developer
- Posts: 844
- Joined: Tue Sep 16, 2008 3:00 pm
- Location: Irvine, CA
Re: COM Automation Snag
The Application.Run method is just a way to run an EViews command. The formatting of the command has to be an exact match to the command as if it was typed directly into the EViews command window.
This means you should be able to run the wfopen or the run command directly within EViews first. If it doesn't work there, it won't work via the COM interface.
This means you should be able to run the wfopen or the run command directly within EViews first. If it doesn't work there, it won't work via the COM interface.
Who is online
Users browsing this forum: No registered users and 2 guests
