bamaisgreat
Well-known Member
- Joined
- Jan 23, 2012
- Messages
- 831
- Office Version
- 365
- Platform
- Windows
My IT dept uninstalled and reenstalled Excel on my PC the other day. Every since then I have had trouble executing some of the code I use. I seem to get an error when it gets to the part were its saving it to a PDF.Im using 2007. Thanks as always
Code:
Sub job_send()
If Dir("H:\") = "" Then
UserForm1.Label1.Caption = "Error: No Network Connection"
Else
UserForm1.Label1.Caption = "Network Connection Found ! Preparing to Send........"
End If
UserForm1.SHOW vbModeless
Application.Wait Now + TimeSerial(0, 0, 2)
Unload UserForm1
If MsgBox("By pressing Yes you confirm that all information entered is correct.", _
vbCritical + vbYesNo, "") = vbNo Then Exit Sub
ActiveSheet.Unprotect
Dim ButtonName As Variant
Dim ButtonNames As Variant
' Change/add button names accordingly
ButtonNames = Array("Button 3", "Button 5", "Button 7")
For Each ButtonName In ButtonNames
ActiveSheet.Buttons(ButtonName).Visible = False
Next ButtonName
Range("D23").Select
Selection.Interior.ColorIndex = 6
ActiveCell.FormulaR1C1 = "OPERATOR CHECKED"
With ActiveCell.Characters(Start:=1, Length:=14).Font
.name = "Arial"
.FontStyle = "Bold"
.Size = 14
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
End With
Sheets("JOB FORM").Range("H:H").EntireColumn.Hidden = False
'Sheets("JOB FORM").Range("P:P").EntireColumn.Hidden = False
Range("A4:D20").Select
With Selection.Interior
.ColorIndex = 6
.Pattern = xlSolid
End With
Range("G4:O20").Select
With Selection.Interior
.ColorIndex = 6
.Pattern = xlSolid
End With
Range("Q4:T20").Select
With Selection.Interior
.ColorIndex = 6
.Pattern = xlSolid
End With
Range("H20").Select
ActiveWorkbook.save
ActiveWindow.SmallScroll Down:=-6
Range("I4").Select
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
ActiveWorkbook.save
ActiveWorkbook.SaveAs Filename:="H:\Burney Table\CUTTING FORMS (Protected by QC)\" & _
Format(Now(), "mm-dd-yyyy hh-mm-ss") & " FMI SAW JOB", FileFormat:=xlNormal _
, Password:="", WriteResPassword:="", ReadOnlyRecommended:=False, _
CreateBackup:=False
ButtonNames = Array("Button 6")
For Each ButtonName In ButtonNames
ActiveSheet.Buttons(ButtonName).Visible = False
Next ButtonName
ActiveWorkbook.save
Range("I4").Select
[COLOR=#ff0000] ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
"H:\Burney Table\Cutting Forms PDF\" & Format(Now(), "mm-dd-yyyy hh-mm-ss") & " FMI SAW JOB.pdf", Quality:= _
xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False, _
OpenAfterPublish:=True[/COLOR]
ActiveWorkbook.save