• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 792
  • Last Modified:

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

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
RIAS
Asked:
RIAS
  • 3
1 Solution
 
Arno KosterCommented:
do you mean you cannot save the file when

Rejectfile = "filename.xlsm"

?
0
 
Arno KosterCommented:
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
 
RIASAuthor Commented:
Cheers mate!!!works like charm!
0
 
Arno KosterCommented:
you're welcome !
0
Question has a verified solution.

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.

Join & Write a Comment

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now