Eviews COM AUTOMATION ( EXCEL VBA)

For questions regarding programming in the EViews programming language.

Moderators: EViews Gareth, EViews Moderator, EViews Jason, EViews Matt

EF00
Posts: 19
Joined: Tue Oct 29, 2024 6:33 am

Eviews COM AUTOMATION ( EXCEL VBA)

Postby EF00 » Thu Feb 20, 2025 4:39 am

Hi all,
I’m working with a module in Excel VBA, and everything is running smoothly so far. However, I’ve encountered an issue when trying to implement Denton’s temporal disaggregation method. The code is not behaving as expected, and I’d appreciate your help in troubleshooting it.
Here's the code I'm working with:

Sub eviews_prova()
Dim mgr As New EViews.Manager
Dim app As EViews.Application
Dim wb As Workbook
Dim ws As Worksheet
Dim lastRow As Integer
Dim filePath As String
Dim destSheet As Worksheet
Dim eviewsFile As String
Dim seriesName As String
Dim command As String
Dim outputFilePath As String


filePath = "T:\Divisione Corporate\Dco Servizio Studi E Ricerche\Lavori\Banks-Market trends\ModelloPrevisioneSistemaBancario\Review 2024\Frequency_conversion\Sb2412v1.1.xlsx"


Set wb = Workbooks.Open(filePath)
Set ws = wb.Sheets("Tab_base") ' Foglio contenente i dati


lastRow = ws.Cells(Rows.Count, 1).End(xlUp).Row


ws.Range("C7:AUM" & lastRow).Copy


wb.Close False


Set app = mgr.GetApplication(ExistingOrNew)
app.Run "wfcreate q 1999 2032" ' Workfile trimestrale (cambia gli anni se serve)

app.Run "import " & Chr(34) & filePath & Chr(34) & " range=Tab_Base!C7:AUM" & lastRow & " colhead=1 @smpl 1981Q1 2032Q4"


seriesName = "LEV17"

' Temporal disagreggation with Denton
app.Run "series " & seriesName & "_m = @denton(" & seriesName & ", m, s)"

' Save date in an external CVS file
outputFilePath = "C:\Percorso\Del\Tuo\File_Mensilizzato.csv"
app.Run "wfsave(type=csv) " & outputFilePath


End Sub


I’ve highlighted in bold the command that is not working as expected. Specifically, I’m trying to apply Denton’s temporal disaggregation method, but it doesn't work correclty.

After resolving this issue, I plan to extend the code to import the monthly series from the CSV file.

Could anyone suggest what might be going wrong or help improve the code?

Thanks in advance for your help!

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13583
Joined: Tue Sep 16, 2008 5:38 pm

Re: Eviews COM AUTOMATION ( EXCEL VBA)

Postby EViews Gareth » Thu Feb 20, 2025 6:38 am

There is no @denton function in EViews.

Denton interpolation is done via the copy command when copying between two pages of a workfile.

EF00
Posts: 19
Joined: Tue Oct 29, 2024 6:33 am

Re: Eviews COM AUTOMATION ( EXCEL VBA)

Postby EF00 » Thu Feb 20, 2025 7:12 am

Is it possible to enhance my macro to achieve this? For example, by creating a new page in my workfile with monthly data and then using VBA to disaggregate the series, allowing for copying and pasting between the two pages?

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13583
Joined: Tue Sep 16, 2008 5:38 pm

Re: Eviews COM AUTOMATION ( EXCEL VBA)

Postby EViews Gareth » Thu Feb 20, 2025 9:19 am

Yes, you can use the pagecreate command to create a new page, and the copy command to copy from one to the other.


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests