VBA Hell

2clacaze

New Member
Joined
May 26, 2016
Messages
28
Here is my code





Sub SaveWOWithNewName()


Dim strNew As String
Dim F5 As Range

strNew = "C:\Users\AdminAssist\Dropbox\Work Orders\Work Order Index\@1.xlsm"

Application.ScreenUpdating = False

With ActiveSheet
Set F5 = .Range("F5")
.Copy
End With

ActiveWorkbook.SaveAs Replace(strNew, "@1", F5.Value), FileFormat:=xlOpenXMLWorkbookMacroEnabled
With ActiveSheet
F5.Value = F5.Value + 1
.Range("A9:G19,B4:B7,E20,E48,F7").ClearContents
End With

Application.ScreenUpdating = True

Set F5 = Nothing

End Sub

with my red line popping up as the debug line. Got the code as a modified version of my original from another posted thread that died. Dont know what is going on. getting run-time errors telling me the file doesnt exist and is listing a filepath that is in the folder I like, but not it. something like: "C:\\Users\AdminAssist\Dropbox\Work Orders\Work Order Index\6\253492\"

Frustrating. Not a seasoned coder.
Plz help.
 

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.
Hello 2clacaze,

Your failing line should be...
Rich (BB code):
ActiveWorkbook.SaveAs FileName:=Replace(strNew, "@1", F5.Value), FileFormat:=xlOpenXMLWorkbookMacroEnabled
Any variable name that has a ":=" suffix is a Named Argument.
 
Upvote 0

Forum statistics

Threads
1,215,472
Messages
6,125,011
Members
449,204
Latest member
tungnmqn90

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
Back
Top