Help, I am not a programmer and would like to make this code work

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
Option Explicit
Public Const drive As String = " file://\50idahn01company \50idahn01company "
Public Const shmtpath As String = "0_ida0shpmts" loc of shipment log file<br/>
Public Const shmtfile As String = "shmtlog.xlxs"
Public Const shmtnumpath As String = "0_ida0shpmts" loc of shipment number file<br/>
Public Const shmtnumfile As String = "shmtnumbers.xls" to track shipment # sequence
Public Const blankpath As String = "0_ida0shpmts" loc of shipment blank file<br/>
Public Const blankfile As String = "ShipmentBlank.xls" for creating new shipment
Public Const destpath As String = "0_ida0shpmts" directory to save new shipments<br/>
Public Const destfile As String = ".xls" in - and extension for new files
Public Const sipath As String = "0_ida0shpmts0si" loc of SI_Master file for<br/>
Public Const sifile As String = "_SI_Master.xls" shipping inspections
Public Const labelpath As String = "0_ida0shpmts" loc of file with label templates<br/>
Public Const labelfile As String = "Label_Sheet.xls"
Public Const packpath As String = "0_ida0shpmts" Loc of file with lot info<br/>
Public Const packfile As String = "Lot_Info.xls"
Public Const start_row As Integer = 5050 row to start in shipment log<br/>

update occasionaly
Public Const num_of_lines As Integer = 11 number of production lines was 6
Public wb, wb2 As Workbook<br/>
Public ws, ws2, ws3 As Worksheet<br/>
Public ac, rng, rng2, rng3, rng4, rng5, rng6 As Range<br/>
Public sr As ShapeRange<br/>
Public ic1, ic2, ic3 As Integer Counters for Loops<br/>
Public increment1, increment2, increment3 As Integer incremental counters<br/>
Public flag, flag2, flag3 As Boolean true/false conditional flags<br/>
Public deskjet As String<br/>
Public labels As String<br/>
Public chkrng As String<br/>
Public print_range As String<br/>
Public printer_name As String<br/>
Public dbs As DAO.Database<br/>
Public user As String
Sub GetUser()<br/>
user = Application.UserName<br/>
End Sub
Sub SheetPrinter()<br/>
GetUser<br/>
If user = "Mary.Williams" Then<br/>
printer_name = "Brother MFC-9840CDW on Ne06:"<br/>
End If<br/>
If user = "Allison.Smith" Then<br/>
printer_name = "Brother MFC-9840CDW on Ne06"<br/>
End If<br/>
For ic1 = 0 To 12 WAS 4<br/>
On Error Resume Next<br/>
Application.ActivePrinter = printer_name & ic1 & ":"<br/>
Application.ActivePrinter = " file://\IDA-4hp \IDA-4hp business inkjet 1100 series on Ne0" & ic1 & ":"<br/>
Application.ActivePrinter = " file://\IDA-6HP \IDA-6HP OfficeJet T Series Printer on Ne0" & ic1 & ":"<br/>
Application.ActivePrinter = "Deskjet 9600 on Ne0" & ic1 & ":"<br/>
Application.ActivePrinter = " file://\IDA-6HP \IDA-6HP Officejet 7400 series on Ne0" & ic1 & ":"<br/>
Application.ActivePrinter = "Adobe PDF on Ne0" & ic1 & ":"<br/>
Application.ActivePrinter = "hp business inkjet 1100 series on Ne0" & ic1 & ":"<br/>
Next ic1<br/>
done:<br/>
End Sub
Sub LabelPrinter()<br/>
GetUser<br/>
If user = "Mary.Williams" Then<br/>
printer_name = " file://\Ida7Epson \Ida7Epson FX-850(Labels)on Ne07:"
<br/>
<br/>
End If<br/>
For ic1 = 0 To 12<br/>
On Error Resume Next<br/>
Application.ActivePrinter = printer_name & ic1 & ":"<br/>
Application.ActivePrinter = "Adobe PDF on Ne0" & ic1 & ":"<br/>
Next ic1<br/>
Set 4X3Labels<br/>
done:<br/>
End Sub
Sub IdentifyPrinter()<br/>
Debug.Print Application.UserName<br/>
Debug.Print ActivePrinter<br/>
End Sub
Sub PaperSizeInfo()<br/>
Dim papersizes As Variant<br/>
Dim papersize As Variant<br/>
Dim papersizenumbers As Variant<br/>
Dim papersizenumber As Variant<br/>
papersizenumbers = GetPaperSizeNumbers<br/>
papersizes = GetPaperSizeNames<br/>
For Each papersizenumber In papersizenumbers<br/>
Debug.Print papersizenumber<br/>
Next papersizenumber<br/>
For Each papersize In papersizes<br/>
Debug.Print papersize<br/>
Next papersize<br/>
End Sub

End Sub

I can not get the printers to work. Do I need to reference something in the tools menu in visual basic, do I need to add something to the properties of either printer?? I am at a loss. I know the user name is correct and the printer name
is correct so what am i doing wrong. I feel that the solution is simple but I sure cant figure it out. Thanks in advance for any help. The label printer is connected to another computer and the Brother printer is on the server.

View the full article
 
Back
Top