Saving all online files to offline

D

Dee

How will I code a macro to save all plans offline, instead of manually
saving each file offline. It is a long and tedious job.

I know that 'Active Project' sets it to the open file, but is there
something completely opposite (since I don't want to open all the
plans)?


I could try to loop all the plans on the server and set it to offline,
but don't know if that is possible.....Any ideas?
 
J

Jan De Messemaeker

If you can loop all the plans, the most difficult is done.
Open them and save them offline.
 
J

Jan De Messemaeker

Hi,

That indeed is the problem for me since I know nearly nothing about SQL,
Sorry!
I once received some code but I did not understand it, sorry.
Maybe you better re-post just this question: How do I open all projects from
a server in VBA?
(I will carefully keep the answer)
 
G

Gérard Ducouret

Hello,
Please find this piece of VBA macro which reads some information about all
the projects in a SQL database:
Gérard Ducouret

Sub Lecture()
Dim sQuery As String
Dim sPathFile As String, i As Integer

' Ouverture de connection à SQL Server par l'intermédiaire d'un DSN
système
Set cn = CreateObject("ADODB.Connection")
cn.Mode = adModeRead 'adModeReadWrite (Lecture seule!)
cn.ConnectionString = "DSN=" & DSN & ";UID=" & STR_USER_IDENT & " ;PWD="
& STR_PASSWORD_IDENT & ";"
cn.Open

'1ere Requête :
' Récupération des enregistrements de la table des projets de la base de
données pointé par le DSN
sQuery = "SELECT * FROM MSP_PROJECTS"
Set rst = CreateObject("ADODB.Recordset")
Set rst = cn.Execute(sQuery, , adCmdText)

sPathFile = "c:\InfoProj.txt"
Open sPathFile For Output As #1
Print #1, ""

With rst
While Not .EOF
i = i + 1
Print #1, "********************"
Print #1, "Nom du projet : " & ![PROJ_NAME]
Print #1, "Nom de l'auteur : " & ![PROJ_PROP_AUTHOR]
Print #1, "Nom de la compagnie : " & ![PROJ_PROP_COMPANY]
Print #1, "Date début du projet : " & ![PROJ_INFO_START_DATE]
Print #1, "Date d'état du projet : " & ![PROJ_INFO_STATUS_DATE]
Print #1, "Date fin du projet : " & ![PROJ_INFO_FINISH_DATE]
Print #1, "Nom du Manager : " & ![PROJ_PROP_MANAGER]
Print #1, "Heure de début par défaut projet : " &
![PROJ_OPT_DEF_START_TIME]
Print #1, "Heure de fin par défaut projet : " &
![PROJ_OPT_DEF_FINISH_TIME]
.../...
Set rst = Nothing
Print #1, "********************"
Close #1
MsgBox "Fini : " & i & " plannings dans la Base <<LocalServer>>", ,
"Gérard DUCOURET : PragmaSoft ®"
End Sub
 

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