Solved

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

Posted on 2011-03-16
4
759 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
4 Comments
 
LVL 19

Expert Comment

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

Rejectfile = "filename.xlsm"

?
0
 
LVL 19

Accepted Solution

by:
Arno Koster 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:Arno Koster
ID: 35148262
you're welcome !
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
If you need to forecast numbers -- typically for finance -- the Windows and Mac versions of Excel 2016 have a basket of tools to get the job done.
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …
This Micro Tutorial will demonstrate on a Mac how to change the sort order for chart legend values and decrpyt the intimidating chart menu.

628 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