Overwrite automation problem

M

mr.potato

Hi all,

I have encountered a problem when I tried to code a auto-save macro for
saving project in database, the "overwrite dialog" has came out while saveas
function was being run. After I have applied the "displayAlerts = False" in
the begining, the error has prompted out....

Does any method can overwrite duplicate project without pop-up message?

On top of that , I've also tried to write a macro for deleting the existing
project before save, but it's fail. The error message is " [Microsoft][ODBC
SQL Server Driver]Communication link failure " , attacehed below is my code.


Dim db_sql As String
Dim db_con As Object
Dim db_rec As Object

db_sql = "SELECT PROJ_NAME FROM MSP_PROJECTS WHERE PROJ_NAME = 'abc' "

db_rec.Open db_sql, db_con

If Not db_rec.BOF And Not db_rec.EOF Then Application.DeleteFromDatabase
Name:=<HELLO>\abc, userID:="sa", databasePassword:="xxxx",
formatID:="MSProject.ODBC"

ActiveProject.SaveAs Name:=<HELLO>\abc, userID:="sa",
databasePassword:="xxxx", formatID:="MSProject.ODBC"



Thanks & Regards,
smallPotato.
 
R

Rod Gill

What's wrong with the FileSave method? That has no over-write implications.

To delete a project from the database use the DeleteFromDatabase method
 
S

smallPotato

Thanks for your prompt reply. but unfortunately, the project have to save
into another distributed database, I think FileSave cannot be applied in this
situation.

For deleteing projects, I've already used "DeleteFromDatabase" as written
below, but I have no idea why the error message came out while saving the new
version of project.

Do you have any other suggestion?

Many thanks,
smallPotato.


Rod Gill said:
What's wrong with the FileSave method? That has no over-write implications.

To delete a project from the database use the DeleteFromDatabase method

--

Rod Gill
Project MVP
Visit www.msproject-systems.com for Project Companion Tools and more


mr.potato said:
Hi all,

I have encountered a problem when I tried to code a auto-save macro for
saving project in database, the "overwrite dialog" has came out while
saveas
function was being run. After I have applied the "displayAlerts = False"
in
the begining, the error has prompted out....

Does any method can overwrite duplicate project without pop-up message?

On top of that , I've also tried to write a macro for deleting the
existing
project before save, but it's fail. The error message is "
[Microsoft][ODBC
SQL Server Driver]Communication link failure " , attacehed below is my
code.


Dim db_sql As String
Dim db_con As Object
Dim db_rec As Object

db_sql = "SELECT PROJ_NAME FROM MSP_PROJECTS WHERE PROJ_NAME = 'abc' "

db_rec.Open db_sql, db_con

If Not db_rec.BOF And Not db_rec.EOF Then
Application.DeleteFromDatabase
Name:=<HELLO>\abc, userID:="sa", databasePassword:="xxxx",
formatID:="MSProject.ODBC"

ActiveProject.SaveAs Name:=<HELLO>\abc, userID:="sa",
databasePassword:="xxxx", formatID:="MSProject.ODBC"



Thanks & Regards,
smallPotato.
 
T

TomG

smallPotato,
I'm not sure if this is the only problem, but your [Name:=] argument needs
to be a string i.e. Name:="<HELLO>\abc", userID:="sa",

Regards,
Tom


Syntax

expression .FileSaveAs(Name, Format, Backup, ReadOnly, TaskInformation,
Filtered, Table, UserID, DatabasePassWord, FormatID, Map, Password,
WriteResPassword, ClearBaseline, ClearActuals, ClearResourceRates,
ClearFixedCosts, XMLName)
expression Optional. An expression that returns an Application object.

Name Optional String. The name of a new project under which the active
project will be saved or the name of the database where the data will be
exported.

smallPotato said:
Thanks for your prompt reply. but unfortunately, the project have to save
into another distributed database, I think FileSave cannot be applied in this
situation.

For deleteing projects, I've already used "DeleteFromDatabase" as written
below, but I have no idea why the error message came out while saving the new
version of project.

Do you have any other suggestion?

Many thanks,
smallPotato.


Rod Gill said:
What's wrong with the FileSave method? That has no over-write implications.

To delete a project from the database use the DeleteFromDatabase method

--

Rod Gill
Project MVP
Visit www.msproject-systems.com for Project Companion Tools and more


mr.potato said:
Hi all,

I have encountered a problem when I tried to code a auto-save macro for
saving project in database, the "overwrite dialog" has came out while
saveas
function was being run. After I have applied the "displayAlerts = False"
in
the begining, the error has prompted out....

Does any method can overwrite duplicate project without pop-up message?

On top of that , I've also tried to write a macro for deleting the
existing
project before save, but it's fail. The error message is "
[Microsoft][ODBC
SQL Server Driver]Communication link failure " , attacehed below is my
code.


Dim db_sql As String
Dim db_con As Object
Dim db_rec As Object

db_sql = "SELECT PROJ_NAME FROM MSP_PROJECTS WHERE PROJ_NAME = 'abc' "

db_rec.Open db_sql, db_con

If Not db_rec.BOF And Not db_rec.EOF Then
Application.DeleteFromDatabase
Name:=<HELLO>\abc, userID:="sa", databasePassword:="xxxx",
formatID:="MSProject.ODBC"

ActiveProject.SaveAs Name:=<HELLO>\abc, userID:="sa",
databasePassword:="xxxx", formatID:="MSProject.ODBC"



Thanks & Regards,
smallPotato.
 
S

smallPotato

Hi Tom,

Sorry for my mistyping, it has quotation mark in my original code so it
should not be the case of argument problem, but anyway thanks for your
kindest reply~

Rgds,
smallPotato.

TomG said:
smallPotato,
I'm not sure if this is the only problem, but your [Name:=] argument needs
to be a string i.e. Name:="<HELLO>\abc", userID:="sa",

Regards,
Tom


Syntax

expression .FileSaveAs(Name, Format, Backup, ReadOnly, TaskInformation,
Filtered, Table, UserID, DatabasePassWord, FormatID, Map, Password,
WriteResPassword, ClearBaseline, ClearActuals, ClearResourceRates,
ClearFixedCosts, XMLName)
expression Optional. An expression that returns an Application object.

Name Optional String. The name of a new project under which the active
project will be saved or the name of the database where the data will be
exported.

smallPotato said:
Thanks for your prompt reply. but unfortunately, the project have to save
into another distributed database, I think FileSave cannot be applied in this
situation.

For deleteing projects, I've already used "DeleteFromDatabase" as written
below, but I have no idea why the error message came out while saving the new
version of project.

Do you have any other suggestion?

Many thanks,
smallPotato.


Rod Gill said:
What's wrong with the FileSave method? That has no over-write implications.

To delete a project from the database use the DeleteFromDatabase method

--

Rod Gill
Project MVP
Visit www.msproject-systems.com for Project Companion Tools and more


Hi all,

I have encountered a problem when I tried to code a auto-save macro for
saving project in database, the "overwrite dialog" has came out while
saveas
function was being run. After I have applied the "displayAlerts = False"
in
the begining, the error has prompted out....

Does any method can overwrite duplicate project without pop-up message?

On top of that , I've also tried to write a macro for deleting the
existing
project before save, but it's fail. The error message is "
[Microsoft][ODBC
SQL Server Driver]Communication link failure " , attacehed below is my
code.


Dim db_sql As String
Dim db_con As Object
Dim db_rec As Object

db_sql = "SELECT PROJ_NAME FROM MSP_PROJECTS WHERE PROJ_NAME = 'abc' "

db_rec.Open db_sql, db_con

If Not db_rec.BOF And Not db_rec.EOF Then
Application.DeleteFromDatabase
Name:=<HELLO>\abc, userID:="sa", databasePassword:="xxxx",
formatID:="MSProject.ODBC"

ActiveProject.SaveAs Name:=<HELLO>\abc, userID:="sa",
databasePassword:="xxxx", formatID:="MSProject.ODBC"



Thanks & Regards,
smallPotato.
 
Top