Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Solved my own problem haha</p> <p>Oracle Certified Professional was right. All I had to do was add another statement to move the cursor back to the beginning. I just added WordApp.Selection.GoTo 1 to the beginning. </p> <pre><code>Option Explicit 'Procedure to edit word document add name and serial number. Sub SearchAndRep(searchTerm, replaceTerm, WordApp) WordApp.Selection.GoTo 1 With WordApp.Selection.Find .ClearFormatting .Replacement.ClearFormatting .MatchWholeWord = True .Text = searchTerm .Execute ,,,,,,,,,replaceTerm End With End Sub Dim WordApp Dim WordDoc Dim strReadCompName Dim strReadCompSN Dim objNetwork, WSHPrinters, counter 'Enumerate through printers to find local Zebra printer. Set objNetwork = CreateObject("WScript.Network") Set WSHPrinters = objNetwork.EnumPrinterConnections For counter = 0 To WSHPrinters.Count - 1 Step 2 If Left(WSHPrinters.Item(counter +1), 5) = "Zebra" Then WScript.Echo(WSHPrinters.Item(counter +1)) objNetwork.SetDefaultPrinter(WSHPrinters.Item(counter +1)) End If Next 'Create a Microsoft Word Object and make it invisible. Set WordApp = CreateObject("Word.Application") WordApp.Visible = FALSE 'Open LabelTemplate.doc for editing. Set WordDoc = WordApp.Documents.Open("C:\LabelTemplate.doc") 'Read in name and serial number to print on label. strReadCompName = InputBox("Enter Computer Name", "Name") strReadCompSN = InputBox("Enter Serial Number", "Serial") 'Procedures to edit the Word Document to add name and serial number. SearchAndRep "nametext", strReadCompName, WordApp SearchAndRep "serialtext", strReadCompSN, WordApp 'Print out the label. 'WordApp.PrintOut() 'Set the default printer back to what it was before. 'Still have to do this. objPrinter.SetDefaultPrinter "\\******\**********" WordDoc.Saved = TRUE WordDoc.Close WordApp.Quit </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload