VBA Code to Run External File Commands....

M

me4now

Hello,
I have a small VB Code that trying to do 2 different things, but both
need to go outside of Excel.

( copy / paste )


'Open "C:\myfile.PAS \\BLOCKP_5\WDDrop" For Output As #1
'Copy "C:\myfile.PAS \\BLOCKP_5\WDDrop"
'Paste "\\blockP_5\WDDrop"
'Close #1


Problem :

I run a macro that takes the contents and creates a .PAS File, (
midified CSV ), that file is then copied to a Label Program ( Loftware
) and it prints out labels.
Currently, I added a command button to click on it to run the macro,
it copies file to the C:\ drive, then I minimize the spreadsheet, and
click on a batch file to copy the file to the Network Print Server,
Drop folder...

I Tried the code, chopped down,



Dim LP As String blah,blah,..
Dim I As Integer
Dim theCell As Range
Dim theFile As Integer
Set theCell = Range("a1")

Open "c:\myfile.pas" For Output As #1
For I = 2 To 10000

Set theCell = theCell.Offset(1, 0)
LP = theCell.Value

If LP <> "" Then
LPType = theCell.Offset(0, 1).Value
'TR = theCell.Offset(0, 2).Value
'

Print #1, "*FORMAT,myfile.lwl "
' Print #1, "*JOBNAME,SampleJob002"
Print #1, "*QUANTITY,1"
Print #1, "*PRINTERNUMBER,15"
Print #1, "*PRINTLABEL"

'Open "C:\OS_ID_Z4M.PAS \\BLOCKP_5\WDDrop" For Output As #1
'Copy "C:\OS_ID_Z4M.PAS \\BLOCKP_5\WDDrop"
'Paste "\\blockP_5\WDDrop"
'Close #1


Else
Close #1
GoTo BYE
End If

Next I
BYE:
End Sub








'Open "C:\myfile.PAS \\BLOCKP_5\WDDrop" For Output As #1
'Copy "C:\myfile.PAS \\BLOCKP_5\WDDrop"
'Paste "\\blockP_5\WDDrop"
'Close #1


it just errors out.

myfile.pas is the file i normally copy to the network drive
\\BLOCKP_5\WDDrop....


would be nice to just to attach this statement at the end of the
macro, then close it...


Thanks for any help anyone can give me!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top