Excel VBA works for 1 user, but not another

shouyeah

New Member
Joined
Feb 26, 2009
Messages
8
I have a Excel file using VBA that I am able to run all macros just fine. Another user was able to run the file just fine last month and the month before, but for some reason, she is unable to run the macro this month. When running the macros, she gets the Run Time error 1004, application or object defined error. She sent me the copy of the file she was using and I was able to run the macros with no issues. When she clicks "debug", it highlights

Code:
Selection.QueryTable.Refresh BackgroundQuery:=False

Any ideas as to why she is all of a sudden unable to run the macros when she was able to do it before?
 

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest

prabby25101981

Active Member
Joined
Jul 28, 2010
Messages
348
Could be an issue with the version difference. Did she upgrade or downgrade her version of excel in recent past?
 

p45cal

Well-known Member
Joined
Nov 10, 2009
Messages
4,763
Is the same cell(s) selected when both of you run it?
What is the query-table querying? Is it available to her? Test by refreshing maually.
 

Taul

Well-known Member
Joined
Oct 24, 2004
Messages
753
Office Version
  1. 2019
  2. 2016
Platform
  1. Windows
has she enabled Analysis toolpak VBA in the tools Add-Ins menu
 

shouyeah

New Member
Joined
Feb 26, 2009
Messages
8
Thanks for the ideas...however:
  1. prabby25101981: There is a version difference. I created the file using Excel 2002 and she has Excel 2003. However, she had Excel 2003 last month when she ran the file and it worked fine, so I'm inclined to think the version is not the issue since it worked before.
  2. p45cal: The same cell is selected. It is in the VBA to select cell A1 first before running the query.
    • I also had her right click on cell A1 and then click "Refresh Data", however nothing happened.
    • When I manually right click on A1 and click "Refresh Data", the data refreshes.
    • The query uses a "generic/shared" Data source and User Name, so nothing is tied to her or my individual user name.
  3. Paul-H: The Analysis Toolpak and Analysis Toolpak VBA items were already "checked".
Any additional ideas would be greatly appreciated.
 

p45cal

Well-known Member
Joined
Nov 10, 2009
Messages
4,763
p45cal: The same cell is selected. It is in the VBA to select cell A1 first before running the query.
  • I also had her right click on cell A1 and then click "Refresh Data", however nothing happened.
  • When I manually right click on A1 and click "Refresh Data", the data refreshes.
So you can manually refresh, she can't. Then it's not likely to be vba the problem, more the querytable can't refresh because perhaps the source data isn't available to it, or the querytable itself has been corrupted or lost altogether. Time for some detective work.
 

Watch MrExcel Video

Forum statistics

Threads
1,133,272
Messages
5,657,774
Members
418,413
Latest member
Radoslaw Poprawski

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