Advertisement

02.05.2008 at 06:30PM PST, ID: 23140173
[x]
Attachment Details

Trying to Save a File in Excel with VB.NET

Asked by sporenza in .NET, Microsoft Visual Basic.Net

Tags: VB.Net, Excel Save File

Ok my program is attached very simple, I get an error before I see the After Save text...

This exe works fine on my development machine but not on a different machine....

Unhandled Exception: System.Runtime.InteropServices.COMException (0x800A03EC): SaveAs method of Work
   at Microsoft.VisualBasic.CompilerServices.LateBinding.InternalLateCall(Object o, Type objType, St
ring[] paramnames, Boolean[] CopyBack, Boolean IgnoreReturn)
   at Microsoft.VisualBasic.CompilerServices.NewLateBinding.LateCall(Object Instance, Type Type, Str
uments, String[] ArgumentNames, Type[] TypeArguments, Boolean[] CopyBack, Boolean IgnoreReturn)
   at ConsoleApplication1.Module1.Main()
Start Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
Imports System.IO
Imports System.Console
 
Module Module1
 
    Sub Main()
 
        Dim excelApplication As Object = CreateObject("Excel.Application")
        Dim excelWorkbook As Object = excelApplication.Workbooks.Add()
 
        excelWorkbook = excelApplication.ActiveWorkbook
        WriteLine("Before Save")
        excelWorkbook.SaveAs(filename:="C:\Test", FileFormat:=56)
        WriteLine("After Save")
        Exit Sub
 
 
    End Sub
 
 
End Module
[+][-]02.05.2008 at 06:39PM PST, ID: 20829035

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]02.05.2008 at 07:36PM PST, ID: 20829251

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]02.05.2008 at 10:39PM PST, ID: 20830018

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]02.05.2008 at 11:15PM PST, ID: 20830143

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: .NET, Microsoft Visual Basic.Net
Tags: VB.Net, Excel Save File
Sign Up Now!
Solution Provided By: sporenza
Participating Experts: 1
Solution Grade: A
 
 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628