Need to edge out the competition for your dream job? Train for certifications today.
This course will introduce you to C++ 11 and teach you about syntax fundamentals.
Option Explicit On
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim mybook As Microsoft.Office.Interop.Excel.Workbook
Dim xlApp As Microsoft.Office.Interop.Excel.Application
' Error trapping
On Error GoTo errTrap
' Quit if no file was specified
If Command() = "" Then Exit Sub
' Open excel document
xlApp = New Microsoft.Office.Interop.Excel.Application
mybook = xlApp.Workbooks.Open(Command, , , , , "")
' Close excel
MsgBox(Err.Description, vbInformation, "Excel document printing")
Open in new window
Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.
Have a better answer? Share it in a comment.
Please enter a first name
Please enter a last name
Must be at least 4 characters long.
Join and Comment
From novice to tech pro — start learning today.
Premium members can enroll in this course at no extra cost.