How do I use Workbook.Add

N

Neyboy18

Hi, My routine creates a new workbook from a template
that contains links but I don't want to update the Links
yet.
So I use the line
Workbooks.Add templateStr
This works fine but every time it runs asks if I want to
update the Links.
Is it possible to amend the line so that it does not
update the Links and does not ask the question?
 
G

GB

Newboy18 said:
Thanks, but because the default is to Update the links,
wont this do the same?

Would this help you?

ActiveWorkbook.UpdateRemoteReferences = False

(Insert in code before opening template, then set back to true again
afterwards.)
 
N

Newboy18

Hi thanks for the ideas but it still asks to Update Links
and the default checkbox is still set to Update Links
This is what I have so far:

ActiveWorkbook.UpdateRemoteReferences = False
Application.DisplayAlerts = False
Workbooks.Add templateStr
Application.DisplayAlerts = True
ActiveWorkbook.UpdateRemoteReferences = True
 
T

Tom Ogilvy

I don't believe there is a way to avoid this in xl2000 and earlier with a
setting. In xl2002 there is a setting to suppress this query (so you would
set it in the template - it is under the links option in the edit menu as I
recall - but if the workbook were opened in an earlier version, this would
not work).

UpdateRemoteReferences does not affect the question.

The way I would do this is open the template as a workbook, then saveas
using a new name so you don't overwrite your template. When you open the
template, set the updatelinks argument to 0

Workbooks.Open "C:\MyTemplate.xlt", UpdateLinks:=0
ActiveWorkbook.SaveAs "C:\MyTemplate1.xls", Fileformat:=xlWorkbookNormal
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top