I was executing macro Code and trying to access excel and powerpoint file from the macro code. While executing the macro Code getting below error :
Compile Error:
User Defined Datatype not defined
Here are the few lines of the Macro Code:
Dim V_Excel As Excel.Application
Dim v_book As Excel.Workbook
Dim v_sheet As Excel.Worksheet
Dim v_ppt As Presentation
Dim v_slide As Slide
Dim v_book As Excel.Workbook
Dim v_sheet As Excel.Worksheet
Dim v_ppt As Presentation
Dim v_slide As Slide
Solution
After doing the R&D, getting the result from google that this problem can be solved using late binding methods
Dim V_Excel As Object
Set V_Excel = CreateObject("Excel.Application")
Dim v_book As Object
Set v_book = CreateObject("Excel.Workbook")
Dim v_sheet As Object
Set v_sheet = CreateObject("Excel.Worksheet")
Dim v_ppt As Object
Set v_ppt = CreateObject("Presentation")
Dim v_slide As Object
Set v_slide = CreateObject("Slide")
Set V_Excel = CreateObject("Excel.Application")
Dim v_book As Object
Set v_book = CreateObject("Excel.Workbook")
Dim v_sheet As Object
Set v_sheet = CreateObject("Excel.Worksheet")
Dim v_ppt As Object
Set v_ppt = CreateObject("Presentation")
Dim v_slide As Object
Set v_slide = CreateObject("Slide")
No comments:
Post a Comment