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 COM AUTOMATION ( EXCEL VBA)
Moderators: EViews Gareth, EViews Moderator, EViews Jason, EViews Matt
-
EViews Gareth
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13583
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Eviews COM AUTOMATION ( EXCEL VBA)
There is no @denton function in EViews.
Denton interpolation is done via the copy command when copying between two pages of a workfile.
Denton interpolation is done via the copy command when copying between two pages of a workfile.
Re: Eviews COM AUTOMATION ( EXCEL VBA)
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)
Yes, you can use the pagecreate command to create a new page, and the copy command to copy from one to the other.
Who is online
Users browsing this forum: No registered users and 1 guest
