Hi,
I am trying call VBA code from another worksheet in another workbook and It get error 1004. Can not figure out, and would appreciate help. here is my code:
Public Sub RunSheetMacro()
Dim Obj As Object
Dim wbk1 As New Workbook
Dim wks1 As New Worksheet
Set wbk1 = Application.Workbooks("Management of Academy Topics.xlsm")
Set wks1 = wbk1.Sheets("oea_TopicsLibrary")
wbk1.Activate
wks1.Select
'RunString = "'" & wbk1.Name & "'!" & wks1.Name & "." & "updateTopicLib, obj"
'Debug.Print RunString
Application.Run "'Management of Academy Topics.xlsm'!oea_TopicsLibrary.updateTopicLib"
End Sub
The VBA code routine is in sheet oea_TopicsLibrary of workbook Management of Academy Topics.xlsm and the routine name is updateTopicLib. I know I am something wrong here in syntax. Can it work ? Would appreciate any direction.
Thanks in Advance
I am trying call VBA code from another worksheet in another workbook and It get error 1004. Can not figure out, and would appreciate help. here is my code:
Public Sub RunSheetMacro()
Dim Obj As Object
Dim wbk1 As New Workbook
Dim wks1 As New Worksheet
Set wbk1 = Application.Workbooks("Management of Academy Topics.xlsm")
Set wks1 = wbk1.Sheets("oea_TopicsLibrary")
wbk1.Activate
wks1.Select
'RunString = "'" & wbk1.Name & "'!" & wks1.Name & "." & "updateTopicLib, obj"
'Debug.Print RunString
Application.Run "'Management of Academy Topics.xlsm'!oea_TopicsLibrary.updateTopicLib"
End Sub
The VBA code routine is in sheet oea_TopicsLibrary of workbook Management of Academy Topics.xlsm and the routine name is updateTopicLib. I know I am something wrong here in syntax. Can it work ? Would appreciate any direction.
Thanks in Advance