VBA Error

juan4412

Board Regular
Joined
Oct 17, 2011
Messages
94
On my machine this code works:
Code:
.SaveAs Filename:="C:\Ricardo\mail\" & Format(Range("G3").Value) & ".xls"

But on anothers PC it highlights the word "Format" and says object or library not installed, but they have the same references installed as I do.

What is throwing this error?
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.

AlphaFrog

MrExcel MVP
Joined
Sep 2, 2009
Messages
16,471
Not sure why it's throwing an error, but try using this instead since you are not changing the text format of the G3 value.

.SaveAs FileName:="C:\Ricardo\mail\" & Range("G3").Text & ".xls"
 
Upvote 0

juan4412

Board Regular
Joined
Oct 17, 2011
Messages
94
I'd prefer not to have to change it since it works fine on my machine --- plus it would be a great deal of code to change.

Is it possibly a reference or library that I haveinstalled on my machine that is not on his?
 
Upvote 0

Colin Legg

MrExcel MVP
Joined
Feb 28, 2008
Messages
3,497
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
On your colleague's PC, when you check references in the VBA editor under Tools > Options, do any of the ticked references have the prefix "MISSING"?
 
Upvote 0

juan4412

Board Regular
Joined
Oct 17, 2011
Messages
94
ADVERTISEMENT
Adobe Distiller is flagged as missing, but I didn't think that Adobe Distiller has anything to do with the feature that is throwing a debug error.
 
Upvote 0

Colin Legg

MrExcel MVP
Joined
Feb 28, 2008
Messages
3,497
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
Uncheck the missing reference and try to run the code again. You're correct that Format() is not from that library, but it is confusing Excel in the background.
 
Upvote 0

juan4412

Board Regular
Joined
Oct 17, 2011
Messages
94
ADVERTISEMENT
Unchecking Distiller is still giving me the same debug error.
 
Upvote 0

Colin Legg

MrExcel MVP
Joined
Feb 28, 2008
Messages
3,497
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
If you change the line of code to this, it will still work on your PC and may work on your colleague's:
Rich (BB code):
.SaveAs Filename:="C:\Ricardo\mail\" & VBA.Format(Range("G3").Value) & ".xls"
Give it a try and let us know?
 
Upvote 0

juan4412

Board Regular
Joined
Oct 17, 2011
Messages
94
Well he is pulling the report off of a network drive that we both can access.

It works if I preface the statement with VBA.Date -- But again that is going to leave a LOT of code to change.

Is there another option that I have?
 
Upvote 0

AlphaFrog

MrExcel MVP
Joined
Sep 2, 2009
Messages
16,471
You could use the Find\Replace All (Ctrl+H) feature to make the edits to your code en masse.

Find What: Format(
Replace with: VBA.Format(
Replace All
 
Last edited:
Upvote 0

Forum statistics

Threads
1,195,600
Messages
6,010,651
Members
441,558
Latest member
lambierules

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