VBA word

  • Thread starter Pierre CFI [mvp]
  • Start date
P

Pierre CFI [mvp]

Hello
i am french, sorry :eek:)
On PC
Dim MyPath As String
Dim rep As String

MyPath = ThisDocument.Path & "\" ' Définit le chemin d'accès.
rep = Dir(MyPath & "*.doc", vbDirectory)
Do While (rep <> "")
MsgBox "Fichier " & rep
rep = Dir
Loop

But on Mac ?? office 2004
 
L

little_creature

Hello,
I would start by replacing the "\" by ":"
Which is used in Mac word.
 
J

JE McGimpsey

Pierre CFI said:
Hello
i am french, sorry :eek:)
On PC
Dim MyPath As String
Dim rep As String

MyPath = ThisDocument.Path & "\" ' Définit le chemin d'accès.
rep = Dir(MyPath & "*.doc", vbDirectory)
Do While (rep <> "")
MsgBox "Fichier " & rep
rep = Dir
Loop


First, since * and ? are valid filename characters on the Mac, you can't
use them as wildcards. To specify Word files, you need to use the
MacID() function.

Also, Macs use ":" as the path separator - you can either use that
character directly, or use the Application.PathSeparator property, that
will return ":" for Mac, and "\" for Windows.

So

Dim MyPath As String
Dim rep As String
MyPath = ThisDocument.Path & Application.PathSeparator
rep = Dir(MyPath, MacID("W8BN"))
Do While rep <> vbNullString
MsgBox "Fichier " & rep
rep = Dir
Loop
 
P

Pierre CFI [mvp]

..../...
thank
but Rep = ""
????
Word 2004 pour mac version 11.3

--
Pierre
MVP Access
***************************************
Conseils MPFA: http://www.mpfa.info/
*********************************************************
 
P

Pierre CFI [mvp]

..../...
mais
rep = Dir(MyPath & "baseclient.doc")

rep good baseclient.doc
????? :eek:((((((((((((

--
Pierre
MVP Access
***************************************
Conseils MPFA: http://www.mpfa.info/
*********************************************************
 
J

JE McGimpsey

Pierre CFI said:
.../...
mais
rep = Dir(MyPath & "baseclient.doc")

rep good baseclient.doc
????? :eek:((((((((((((

Not sure what you're asking. If you Dir() a particular file, it will
return that file. I assumed from your using the * that you were looking
for any file with the .doc extension.
 
P

Pierre CFI [mvp]

ahhhhhh yes
my word document is word 2003 (PC),
and is good if is word document 2004 Mac

Thank you
Merci, effectivement je fais les macros sur mon PC, puis je vais sur Mac
aprés
you speak french ? :eek:))

--
Pierre
MVP Access
***************************************
Conseils MPFA: http://www.mpfa.info/
*********************************************************
 
C

Corentin Cras-Méneur

Pierre CFI said:
:eek:) au moins 3 mots de Français

Et une typographie correcte puisqu'il a mis un espace avant le point
d'exclamation - ce qui ne se fait pas en anglais.

Corentin
 
P

Pierre CFI [mvp]

salut collégue
en fait le fait d'ouvrir ces fichiers dot, provenant d'un mac, sur mon PC
office 2003, et de les remettre sur MAC, la routine ne fonctionne plus
donc MacId("W8BN") ne reconnaitrait que du word Mac, bizarre non ??

--
Pierre
MVP Access
***************************************
Conseils MPFA: http://www.mpfa.info/
*********************************************************
 

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