DPChristman
Board Regular
- Joined
- Sep 4, 2012
- Messages
- 176
- Office Version
- 365
- Platform
- Windows
I am trying to rung a 'save as file name' macro, and getting the error:
[h=1]Run-time error '1004': Microsoft Excel cannot access the file c:\program files (x86)\microsoft office\office 14\91cd6000. there are several possible reasons:[/h]
[FONT="]-The file name or path does not exist.[/FONT]
[FONT="]-The file is being used by another program.[/FONT]
[FONT="]-The workbook you are trying to save has the same name as a currently open workbook.
[/FONT]
I had this problem initially last year, but ran into a snag, since it is a format that I send out to a number of people. The (are supposed to) save the format to their computers, and use the format as a blank.
I have included the code below. What can I do to a) prevent the problem going forward and b) make the code portable to whatever laptop it winds up on.
In the example above, I4 represents the location of the data that will be used to name the file
I4= store number Store Name - City, State-district
<tbody>
</tbody>
[h=1]Run-time error '1004': Microsoft Excel cannot access the file c:\program files (x86)\microsoft office\office 14\91cd6000. there are several possible reasons:[/h]
[FONT="]-The file name or path does not exist.[/FONT]
[FONT="]-The file is being used by another program.[/FONT]
[FONT="]-The workbook you are trying to save has the same name as a currently open workbook.
[/FONT]
I had this problem initially last year, but ran into a snag, since it is a format that I send out to a number of people. The (are supposed to) save the format to their computers, and use the format as a blank.
I have included the code below. What can I do to a) prevent the problem going forward and b) make the code portable to whatever laptop it winds up on.
Code:
Sub SaveAsExample()
Dim FName As String
Dim FPath As String
FPath = "C:"
FName = Sheets("Form").Range("I4").Text
ThisWorkbook.SaveAs Filename:=FName
End Sub
In the example above, I4 represents the location of the data that will be used to name the file
I4= store number Store Name - City, State-district
<tbody>
</tbody>