Compile error Question

mayoung

Board Regular
Joined
Mar 26, 2014
Messages
172
Office Version
  1. 365
Platform
  1. Windows
  2. Mobile
Can someone please tell me how I can make this work Thank You?
2509F47B-BDE4-4C32-95BE-68C5498DBA2C.jpeg
 

Some videos you may like

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!

RoryA

MrExcel MVP, Moderator
Joined
May 2, 2008
Messages
36,065
Office Version
  1. 365
  2. 2019
  3. 2016
  4. 2010
Platform
  1. Windows
  2. MacOS
Change the name of your routine to something other than ActiveWorkbook. :)
 

t0ny84

Board Regular
Joined
Jul 6, 2020
Messages
120
Office Version
  1. 365
  2. 2016
  3. 2013
Platform
  1. Windows
  2. Mobile
  3. Web
If the macro is running in this workbook you could try:
workbook.name

Is the workbook called dataminerfile.XML or dataminerfile.XML.xyz?
 

mayoung

Board Regular
Joined
Mar 26, 2014
Messages
172
Office Version
  1. 365
Platform
  1. Windows
  2. Mobile
Change the name of your routine to something other than ActiveWorkbook. :)

I am creating my first Addin and this code is in the addin. How do I refer to the open workbook named DataminerFile.xml I want to make sure this code only runs in this workbook only?
 

mayoung

Board Regular
Joined
Mar 26, 2014
Messages
172
Office Version
  1. 365
Platform
  1. Windows
  2. Mobile
If the macro is running in this workbook you could try:
workbook.name

Is the workbook called dataminerfile.XML or dataminerfile.XML.xyz?

I am creating my first Addin and this code is in the addin. How do I refer to the open workbook named DataminerFile.xml I want to make sure this code only runs when this workbook is active not any other workbook that may be open if the button to run the macro is pressed?
 

RoryA

MrExcel MVP, Moderator
Joined
May 2, 2008
Messages
36,065
Office Version
  1. 365
  2. 2019
  3. 2016
  4. 2010
Platform
  1. Windows
  2. MacOS
If it's called DataminerFile.xml, then you can use Workbooks("DataminerFile.xml"). If your code also opens the workbook, you could store an object reference to it at that point.
 

Watch MrExcel Video

Forum statistics

Threads
1,122,335
Messages
5,595,573
Members
413,996
Latest member
mabelO

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top