call new workbook

K

Kirsty

I am trying to have my macro open a workbook during the run.
I recorded the macro, and opened the workbook, however, when I now run the
workbook, this is not working. Can anyone help me with how to open a new
workbook during a macro
 
J

Jacob Skaria

'To open new workbook
Workbooks.Add

'To open existing workbook
workbooks.Open "<filename>"
 
P

Patrick Molloy

DIM wb as WorkBook
SET wb = Workbooks.Add()

you can now control the workbook using the variable

eg save is
wb.SaveAs {params}
wb.Close {params}

DIM ws as Worksheet
set ws = wb.ActiveSheet

and so on
 

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