I am currently struggling with a vba macro, could you help me please? I would be very thankful to anyone who can help me on this.
I want to access data of an Excel opened workbook from a Word Document macro. For some reasons I need to take data from the Excel workbook which is already opened on my user session and not to reopen it in the background by using its path.
Here is the current bit of macro I want to transform so that I use the “GUI.xls” which is already opened. The window’s name is “Microsoft Excel – GUI.xls [Compatibility Mode]” I hope I explained well enough my problem, I didn’t find this topic elsewhere, sorry if it already exists.
If it is possible I would like that the AppExcel Object is directly linked to the opened Workbook. The problem is that I try to access the Workbook from Word.
Thank you very much for your help,
Simon
Set AppExcel = CreateObject("Excel.Application")
AppExcel.Workbooks.Open SourcePath1 & "" & "\GUI.xls"
Data_Name = AppExcel.Worksheets("Output").Cells(RowNum, 2).value
Data_Ending = AppExcel.Worksheets("Output").Cells(RowNum, 3).value
Dim WordFileName As String
WordFileName = Data_Name & Data_Ending
Call candp(SourcePath, WordFileName, TargetName)
AppExcel.Activeworkbook.Close savechanges:=False
AppExcel.Quit
Set AppExcel = Nothing