happy lin
03-09-2004, 02:41 PM
I just start to learn manipulating about COM in Fortran.
I'd like to activate Excel in my Fortran code through COM,
but the following codes seem not to work.
I have successed initiate the Excel object, but I am stupid to use the object method. Can anyone tell me how?
program COMExample
! this is the namespace the COM object resides in
USE Excel
implicit none
type(Excel%ApplicationClass), pointer :: objExcel
! instantiates the COM object
allocate(objExcel, source=Excel%ApplicationClass())
! make calls to the COM methods
objExcel%Visible = .True. ! this line is OK
Call objExcel%Workbooks%Add() ! this line is Wrong!
pause
deallocate(objExcel)
end program COMExample
I'd like to activate Excel in my Fortran code through COM,
but the following codes seem not to work.
I have successed initiate the Excel object, but I am stupid to use the object method. Can anyone tell me how?
program COMExample
! this is the namespace the COM object resides in
USE Excel
implicit none
type(Excel%ApplicationClass), pointer :: objExcel
! instantiates the COM object
allocate(objExcel, source=Excel%ApplicationClass())
! make calls to the COM methods
objExcel%Visible = .True. ! this line is OK
Call objExcel%Workbooks%Add() ! this line is Wrong!
pause
deallocate(objExcel)
end program COMExample