Solved

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

Posted on 2011-03-16
4
744 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
Comment Utility
do you mean you cannot save the file when

Rejectfile = "filename.xlsm"

?
0
 
LVL 19

Accepted Solution

by:
akoster earned 500 total points
Comment Utility
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
Comment Utility
Cheers mate!!!works like charm!
0
 
LVL 19

Expert Comment

by:akoster
Comment Utility
you're welcome !
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Convert between Excel file formats (.XLS, .XLSX, .XLSM) with/without macro option David Miller (dlmille) Intro Over this past Fall, I've had the opportunity to see several similar requests and have developed a couple related solutions associate…
Improved? Move/Copy Add-in Replacement - How to avoid the annoying, “A formula or sheet you want to move or copy contains the name XXX, which already exists on the destination worksheet.” David Miller (dlmille)  It was one of those days… I wa…
This Micro Tutorial demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.
This Micro Tutorial will demonstrate how to use a scrolling table in Microsoft Excel using the INDEX function.

743 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now