Message 1 of 4
Help - VBA Issues
Not applicable
05-20-2008
12:57 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Trying to run a VBA routine that has worked fine in AutoCAD 2008 but now gives me the following error when running in AutoCAD 2009.
FATAL ERROR: Unhandled Access Violation Writing 0x80534a4d Exception at 650bd6d3h
What the program does:
We have a prototype set of drawings that are stored in a network location. The routine will create a new set of drawings using database entries in Microsoft Access 2003. It works fine up until the same drawing each time. I've checked the drawing and find no issues w/ it. Interestingly, if I create a new dwg w/ the same name, it will process. Could there be content within a drawing that prevents it from being "Saved As" during a vba routine?
Code is listed below.
Private Sub GetFileNames()
Dim strFileName As String
Dim strFilePath As String
Dim strTempName As String
Dim strNewFName As String
Dim strNewPath As String
Dim strPath As String
Dim WS As Workspace
Dim DB As Database
Dim RS As Recordset
DBName = "Templates"
WSName = "M:\DesignForum\database\" + txtWSName.Text
Set WS = DBEngine.Workspaces(0)
Set DB = WS.OpenDatabase(WSName)
Set RS = DB.OpenRecordset(DBName, dbOpenTable)
strFilePath = ThisDrawing.Path
Do While Not RS.EOF
strPath = RS!TemplatePathName
strTempName = RS!TemplateFileName
strFileName = strPath + strTempName
strNewFName = strFilePath + "\" + txtJobNo + "_" + strTempName
ThisDrawing.Application.Documents.Open (strFileName)
ThisDrawing.SaveAs (strNewFName)
ReplacePaths
ThisDrawing.SaveAs (strNewFName)
ThisDrawing.Close
RS.MoveNext
Loop
End Sub
FATAL ERROR: Unhandled Access Violation Writing 0x80534a4d Exception at 650bd6d3h
What the program does:
We have a prototype set of drawings that are stored in a network location. The routine will create a new set of drawings using database entries in Microsoft Access 2003. It works fine up until the same drawing each time. I've checked the drawing and find no issues w/ it. Interestingly, if I create a new dwg w/ the same name, it will process. Could there be content within a drawing that prevents it from being "Saved As" during a vba routine?
Code is listed below.
Private Sub GetFileNames()
Dim strFileName As String
Dim strFilePath As String
Dim strTempName As String
Dim strNewFName As String
Dim strNewPath As String
Dim strPath As String
Dim WS As Workspace
Dim DB As Database
Dim RS As Recordset
DBName = "Templates"
WSName = "M:\DesignForum\database\" + txtWSName.Text
Set WS = DBEngine.Workspaces(0)
Set DB = WS.OpenDatabase(WSName)
Set RS = DB.OpenRecordset(DBName, dbOpenTable)
strFilePath = ThisDrawing.Path
Do While Not RS.EOF
strPath = RS!TemplatePathName
strTempName = RS!TemplateFileName
strFileName = strPath + strTempName
strNewFName = strFilePath + "\" + txtJobNo + "_" + strTempName
ThisDrawing.Application.Documents.Open (strFileName)
ThisDrawing.SaveAs (strNewFName)
ReplacePaths
ThisDrawing.SaveAs (strNewFName)
ThisDrawing.Close
RS.MoveNext
Loop
End Sub