Solved

How to save an .xlsm file in vb.net 2005

Posted on 2011-03-16
4
750 Views
Last Modified: 2012-05-11
Hi,
I have a code to create a .xls file and save it but it does not seem to work with .xlsm


 xlSecondapp = CreateObject("Excel.Application")
                     xlSecondapp.displayalerts = False
                     xlsecondwb = xlSecondapp.Workbooks.add
                     xlsecondws = xlsecondwb.Worksheets(1)
                     If RejectFile <> String.Empty Then
                        xlsecondwb.SaveAs(RejectFile)
                     Else
                     End If


Any suggestions are appreciated
0
Comment
Question by:RIAS
  • 3
4 Comments
 
LVL 19

Expert Comment

by:akoster
ID: 35147158
do you mean you cannot save the file when

Rejectfile = "filename.xlsm"

?
0
 
LVL 19

Accepted Solution

by:
akoster earned 500 total points
ID: 35147271
If so, and you are working with office 2007 or higher, try this :

xlsecondwb.SaveAs(RejectFile, 52)

Open in new window


(from : http://www.rondebruin.nl/saveas.htm)
0
 

Author Closing Comment

by:RIAS
ID: 35147768
Cheers mate!!!works like charm!
0
 
LVL 19

Expert Comment

by:akoster
ID: 35148262
you're welcome !
0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Workbook link problems after copying tabs to a new workbook? David Miller (dlmille) Intro Have you either copied sheets to a new workbook, and after having saved and opened that workbook, you find that there are links back to the original sou…
Freeze panes is an option within all variants of Excel to enable parts of a sheet to remain stationary when the cursor is in another part of the sheet. This is a very useful feature which is overlooked or under used.
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…
This Micro Tutorial will demonstrate on a Mac how to change the sort order for chart legend values and decrpyt the intimidating chart menu.

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question