hi , running macro severale times on different files - problem! pls hlp

B

Bjørn Tore Hovda

Hi, I have this problem here.
i have made a macro( test888 ) who merge data from excel. now im planning to
use this macro in another macro (shown under)
you see i have severale files that i want to update with my macro, so i
thought that i could just list them up like i did under.
somehow the second file dosent start. the update is just done on the first
file.
how can i update severale files in a sequence?



Private Sub CommandButton2_Click()
Dim Dato As String
Dato = UCase(Format(TextBox1.Text, "ddmmmyy"))

FileOpen Name:="\\svg-usr\HOVDABT$\My Documents\B-11.mpp", ReadOnly:=False,
FormatID:="MSProject.MPP"
test888 (Dato)
MsgBox ("1")
FileClose

FileOpen Name:="\\svg-usr\HOVDABT$\My Documents\EKOA.mpp", ReadOnly:=False,
FormatID:="MSProject.MPP"
test888 (Dato)
MsgBox ("2")
FileClose


End Sub

Mvh Bjørn Tore Hovda
 
J

JackD

your test888 macro probably works on activeproject (maybe... be we do not
know for sure) so you need to open the file, make sure that the newly opened
file is the activeproject then execute the macro. I would guess that for
some reason the second file you open is not becoming the activeproject.

I'd rewrite it so that test888 took a project as one of its parameters
Something like this

Sub bjorn()
Dim p As Project
Dim f As String
f = "c:\test.mpp"
FileOpen (f)
Set p = ActiveProject
test888 (p)
FileClose
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