hobster
asked on
Can you pass parameters to a vb program???
Is it possible to pass parameters to a vb program from DOS? Like, can you do the following:
program test1.psd newtest.psd
where program is the exe, test1.psd is the original file, and newtest.psd is the new file created by the program.
Also, is it possible to create a vb program that does not have a GUI?
P.S. Sorry about the lack of points. I've used them all up.
program test1.psd newtest.psd
where program is the exe, test1.psd is the original file, and newtest.psd is the new file created by the program.
Also, is it possible to create a vb program that does not have a GUI?
P.S. Sorry about the lack of points. I've used them all up.
ASKER
Your second answer is correct.
Can you provide more details for the first answer? Below is some simple code that opens an Excel file and saves it to a different name. How would I change the code so I can do the following from the command prompt:
program test.xls newtest.xls
Thank you.
Option Explicit
Sub Main()
Run
End Sub
Private Sub Run()
Dim xlApp As Object
Dim spreadsheet As Object
Set xlApp = CreateObject("excel.Applic ation")
Set spreadsheet = CreateObject("Excel.Sheet" )
spreadsheet.Application.Vi sible = True
Set spreadsheet = xlApp.OpenAs("N:\temp\ole\ test.xls")
spreadsheet.SaveAs "N:\temp\ole\newtest.xls"
spreadsheet.Application.Qu it
spreadsheet.Close
xlApp.Quit
End Sub
Can you provide more details for the first answer? Below is some simple code that opens an Excel file and saves it to a different name. How would I change the code so I can do the following from the command prompt:
program test.xls newtest.xls
Thank you.
Option Explicit
Sub Main()
Run
End Sub
Private Sub Run()
Dim xlApp As Object
Dim spreadsheet As Object
Set xlApp = CreateObject("excel.Applic
Set spreadsheet = CreateObject("Excel.Sheet"
spreadsheet.Application.Vi
Set spreadsheet = xlApp.OpenAs("N:\temp\ole\
spreadsheet.SaveAs "N:\temp\ole\newtest.xls"
spreadsheet.Application.Qu
spreadsheet.Close
xlApp.Quit
End Sub
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Answer of second question is also yes, you can have VB program without GUI. write your code in standard modlue and make Sub Main as startuo in project properties. You have to write a procedure main which will be called first when you run the app. from main you can call other functions