Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

At my wits' end with Access

Status
Not open for further replies.

pmonett

Programmer
Sep 5, 2002
2,627
2
38
FR
I'm working on an Access database that has a macro that is supposed to, in the end, launch Publisher.
So the last action of said macro is to do this :
Code:
"MSPUB.EXE" "V:\xxx\yyy\filename.pub"
That did not work, Access returned a "Can't find object" error.
I then tried to use the complete path, as so :
Code:
"C:\Program Files (x86)\Microsoft Office\Office16\MSPUB.EXE" "V:\xxx\yyy\filename.pub"
Same result.
Just to be sure, I tried the second one in a Command Window, and it worked like a charm.
Could someone please enlighten me as to why Access seemingly refuses to work with Publisher ? It works fine when I launch Word documents.

I've got nothing to hide, and I demand that you justify what right you have to ask.
 
Give that s shot...
Code:
Dim G As Long
G = Shell("MSPUB.EXE " & "V:\xxx\yyy\filename.pub", vbNormalFocus)

---- Andy

"Hmm...they have the internet on computers now"--Homer Simpson
 
As long as it is access macro scripting, the second syntax work for me, with (office 2016) small path correction:
[tt]"C:\Program Files (x86)\Microsoft Office\root\Office16\MSPUB.EXE" "V:\xxx\yyy\filename.pub"[/tt]

combo
 
I tried using root, but the error message does not go away. [sad]

I've got nothing to hide, and I demand that you justify what right you have to ask.
 
I would check the path and name of application in file explorer. A simple method: find mspub.exe, create shortcut, copy path from shortcut properties. And test without document to have clean first part with application only (however wrong document path results opened Publisher and message about wrong document path).

combo
 
Did you try my suggestion? Any issues?

---- Andy

"Hmm...they have the internet on computers now"--Homer Simpson
 
If the V drive is mapped to a server, you might try
[tt]"\\server\servrDir\xxx\yyy\filename.pub"[/tt]
...using your server name etc.

Skip,
[sub]
[glasses]Just traded in my OLD subtlety...
for a NUance![tongue][/sub]
"The most incomprehensible thing about the universe is that it is comprehensible" A. Einstein
 
@Andrzeek : at this time I cannot change that macro line and port it to VBA. I am keeping that on the side though, thank you for the suggestion.

@SkipVought : I am an external consultant, they've mapped the drives I need, and that's all I'm supposed to know :).

What galls me is that either of those commands entered in CMD work fine, so why not in an Access macro ?

I've got nothing to hide, and I demand that you justify what right you have to ask.
 
Okay, final update : it's my corporate laptop that has the problem.
I asked another programmer to test the button and it worked fine on his computer, so it's my computer that has a configuration issue.
And I'm not the one who is supposed to work with this database, so it's not a problem.

Thank you all for your suggestions and your support.

Pascal.

I've got nothing to hide, and I demand that you justify what right you have to ask.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top