Issues with Excel-Related Macro

S

Sebastian Cordoba

Hi guys.

I've a few questions about a macro I'm writing: my goal is to integrate
Project with Excel, generating tables and graphics in this last aplication by
using Project fields.

My questions are:

1- I'm generating a dynamic range using this code (First time I run the code
it works, but the second time it doesn't, I get an error)

Range(Worksheets(nombre).Cells(4, 2), Worksheets(nombre).Cells(4,
2).End(xlDown).Offset(0, 1)).Name = "Rango_Grafica"

What's wrong with it? Why does it work fine the first time but not the
second one?


2- My macro creates a new workbook, operates with it and then close it:

Dim xlarchivo As New Excel.Application
Dim xllibro As Excel.Workbook

Set xllibro= xlFichero.Workbooks.Add
..
..
..

xllibro.Close savechanges:=True
xlarchivo.Quit
Set xlarchivo = Nothing
Set xllibro = Nothing

The problem is: when I run the code for the second time I get the Error 462
"Remote server not available", What does it mean? isn't Excel completely
closed?


3- How do I identify the active Excel workbook? Has it something to do with
the instances of the application?


Thanks in advance.
 
R

Rod Gill

Try recording a macro of you doing what you want manually: twice. The
recorded code should provide your answer, and in your local language as
well.

--

Rod Gill
Microsoft MVP for Project

Author of the only book on Project VBA, see:
http://www.projectvbabook.com
 
S

Sebastian Cordoba

Thank you so much for your interest guys. I'm sorry for not answering soon
enough.

I decided to abort this code and try something else... and it worked.

I hope I can keep counting on you. Bye!
 

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