Setting Printing Path Problem

Setting Printing Path Problem

Anonymous
Not applicable
280 Views
2 Replies
Message 1 of 3

Setting Printing Path Problem

Anonymous
Not applicable
Everyone,

I have created a VBA that sets the printing config paths (plotter, plot style...) and the application works and sets the paths correctly. The problem is even with the paths set correctly the plots and preview doesn't print or look correctly. It's like the pen table isn't being used where the plot should be all black it plots in degrees of gray. He is the kicker... to "fix" the problem I can simply open and Cancel the Opions dialog box without changing a thing, and the print or preview works perfect. Second, the "fix" works until I restart AutoCAD. We're using AutoCAD 2006, but had the same problem with 04.

I'm pretty new to VBA so please be detailed if you can help.

Thanks, Keith
0 Likes
281 Views
2 Replies
Replies (2)
Message 2 of 3

Anonymous
Not applicable
Keith,

Post your code so we an see exactly what you are doing and try and help you.

Maximo
0 Likes
Message 3 of 3

Anonymous
Not applicable
Here is the code....

Private Sub AcadDocument_Activate()

Dim AcadPrefFiles As AcadPreferencesFiles
Dim strDefaultPath As String
Dim strDrawingPath As String
Dim strDrawingPathChar As String
Dim strProjCadd As String
Dim strPrinterPath As String
Dim varCounter As Variant
Dim varPathLen As Variant
Dim fso

Set AcadPrefFiles = ThisDrawing.Application.preferences.Files
strDefaultPath = "Q:\AutoCAD 2006\General\Plotting"
strDrawingPath = ThisDrawing.Path & "\"
strProjCadd = "ProjectCadd\Plotting"
varCounter = Len(strDrawingPath)
Set fso = CreateObject("Scripting.FileSystemObject")

Do While varCounter > 0

strDrawingPath = Left(strDrawingPath, varCounter)
strDrawingPathChar = Right(strDrawingPath, 1)
varCounter = varCounter - 1

If varCounter = 0 Then
AcadPrefFiles.PrinterStyleSheetPath = strDefaultPath
AcadPrefFiles.PrinterConfigPath = strDefaultPath
AcadPrefFiles.PrinterDescPath = strDefaultPath
ElseIf strDrawingPathChar = "\" Then
strPrinterPath = strDrawingPath & strProjCadd
If fso.FolderExists(strPrinterPath) Then
AcadPrefFiles.PrinterStyleSheetPath = strPrinterPath
AcadPrefFiles.PrinterConfigPath = strPrinterPath
AcadPrefFiles.PrinterDescPath = strPrinterPath
varCounter = 0
End If
End If

Loop

End Sub
0 Likes