A
Anthony
I am trying to save an Excel workbook (that has a digital signature
applied if it makes any difference) in Excel 2003 SP2 via VBA using
the ActiveWorkbook.SaveAs command, however I get the follwoing error:
Microsoft Office Excel cannot access the file 'C:\Documents and
Settings\user\Desktop'. There are several possible reasons:
- The file name or path does not exist.
- The file is being used by another program.
- The workbook you are trying to save has the same name as a
currently open workbook.
This is my code residing in the ThisWorkBook module in VBA:
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As
Boolean)
[Run some other code........................]
Dim fname As Variant
fname = Application.GetSaveAsFilename(FileFilter:="Save File As
(*.xls),*.xls", Title:="Save File As")
Application.DisplayAlerts = False
Application.EnableEvents = False
ActiveWorkbook.SaveAs fname
Application.DisplayAlerts = True
Application.EnableEvents = True
End Sub
I checked, and none of the above reasons seem to be true.
I have tried/checked the following things to no avail:
- Removed any add-ins in Excel
- Harcoded the full path/filename
- Tried saving a blank excel file with that simple line of code.
- Tried Me.SaveAs or ThisWorkbook.SaveAs
- Made sure the full file name and path were less than 200 characters
- Tried saving to other locations
- Not using IRM for Excel/Office
- Tried reinstalling office and all updates.
- Tried instyalling the hotfixes from MS KB Articles 919635 and 913770
I dont beleive this is a coding issue as it only occurs on a couple of
PC's.
Anyone have any ideas on how to fix this problem?
applied if it makes any difference) in Excel 2003 SP2 via VBA using
the ActiveWorkbook.SaveAs command, however I get the follwoing error:
Microsoft Office Excel cannot access the file 'C:\Documents and
Settings\user\Desktop'. There are several possible reasons:
- The file name or path does not exist.
- The file is being used by another program.
- The workbook you are trying to save has the same name as a
currently open workbook.
This is my code residing in the ThisWorkBook module in VBA:
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As
Boolean)
[Run some other code........................]
Dim fname As Variant
fname = Application.GetSaveAsFilename(FileFilter:="Save File As
(*.xls),*.xls", Title:="Save File As")
Application.DisplayAlerts = False
Application.EnableEvents = False
ActiveWorkbook.SaveAs fname
Application.DisplayAlerts = True
Application.EnableEvents = True
End Sub
I checked, and none of the above reasons seem to be true.
I have tried/checked the following things to no avail:
- Removed any add-ins in Excel
- Harcoded the full path/filename
- Tried saving a blank excel file with that simple line of code.
- Tried Me.SaveAs or ThisWorkbook.SaveAs
- Made sure the full file name and path were less than 200 characters
- Tried saving to other locations
- Not using IRM for Excel/Office
- Tried reinstalling office and all updates.
- Tried instyalling the hotfixes from MS KB Articles 919635 and 913770
I dont beleive this is a coding issue as it only occurs on a couple of
PC's.
Anyone have any ideas on how to fix this problem?