0

Good Afternoon,

I have a problem with VBA macro. I am trying to download data automatically (with macro) from some SAP software. All is going well to situation when downloaded data are exported to Excel file. I cannot "reach" this workbook with macro cause of error:

Subscript out of range

The reason is that excel sheet is an another instance of Excel.

I do not have a problem with others SAP download files where they are in the same Excel instances.

How can I connect with the second instance of Excel?

Thank you for the help.

Sandra Rossi
  • 11,934
  • 5
  • 22
  • 48
  • Please show the relevant code to make this a [mcve]. Why is your macro creating another instance of Excel? – John Coleman Jan 04 '18 at 12:05
  • SAP creating new instance of excel - not macro (when downloading data to excel) – Swoodie Jan 04 '18 at 12:07
  • See the lower-most example: https://msdn.microsoft.com/en-us/vba/language-reference-vba/articles/getobject-function . Other than that, refer to John's comment - SO isn't a code-writing service, but we can help with fixing code that isn't working. – Vegard Jan 04 '18 at 12:08
  • 1
    You may start here: https://stackoverflow.com/questions/2971473/can-vba-reach-across-instances-of-excel. – MarcinSzaleniec Jan 04 '18 at 12:28
  • I need to connect with another excel instance by VBA (the second instance is not created by me) and makes some actions on this workbook. – Swoodie Jan 04 '18 at 12:29

0 Answers0