Templating a file

Okay I am creating a program that incorporates a MS Excel file into my VB App. I do not want this excel file to be edited in any way. The excel file is like a roster that you save people names on. What I want is to keep this file as a template, so that others can be created from it. Is there a way in VB to open this file and then save it as another filename inputted by the user?
slimbxAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Jon_RaymondCommented:
Open as read-only
0
adityauCommented:
Use the following code.

Dim x As Excel.Application
Set x = New Excel.Application
x.Workbooks.Open xls file name
..
..Do the manipulations
..
x.ActiveWorkbook.SaveAs new xls file name
x.Quit
Set x = Nothing
0
AxterCommented:
You can try pasting the spread sheet on to a Word Document Template.
0
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

slimbxAuthor Commented:
So I open the file as a read only. What do I do when the user adds in their data, because data will be added to this file eventually, then i would set properties to write to the file, you understand my point...
0
adityauCommented:
Did u try my solution? Any comments?
0
slimbxAuthor Commented:
I tried it and it wirks until data is about to be added, then no data can be added because it is set as read only, did not work, sorry. But thanks

0
Jon_RaymondCommented:
Are you saying you want to open as read-only and then change this status to read-write?  Why can't you just save as another document name?
0
adityauCommented:
Don't make the file asd Read-Only. Make it as Read/Write and then try my solution.
0
slimbxAuthor Commented:
I can save it as another document name by changing from read-only to read-write, but I needed the code. I had got it earlier from someone, but rejected them on accident. So I have a solution. I am going to award them the points if I can go back and change my decision. Thanks again
0
slimbxAuthor Commented:
adityau, I tried your solution and it worked. Iapologize, but I rejected the wrong answer. I meant to reject the one from Jon Raymond, not yours. I will post a ques out there right now for you to get the points that I orignally threw out there. Kool.
0
adityauCommented:
Use the following code.

                     Dim x As Excel.Application
                     Set x = New Excel.Application
                     x.Workbooks.Open xls file name
                     ..
                     ..Do the manipulations
                     ..
                     x.ActiveWorkbook.SaveAs new xls file name
                     x.Quit
                     Set x = Nothing
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
slimbxAuthor Commented:
THANKS AGAIN. SORRY ABOUT THE CONFUSION
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.