file association

G

Guest

I have VBA code in a form that creates a .vcs file for importing into the
Outlook Calendar. All I need to do is call that .vcs file and outlook will
start up and ask to save the entry. It works fine outside of Access. If I
go to Windows Explorer and click on vCalendarExport.vcs, an outlook calendar
entry pops us and asks if I want to save the entry.

However, when I run the vCalendarExport.vcs from within VBA code using Call
Shell("C:\vCalendarExport.vcs", vbNormalFocus) a dos window opens and the
message in the dos window says "C:\vCalendarExport.vcs is not recognized as
an internal or external command, operable program or batch file."

What am I doing wrong? Any help would be appreciated.
 
G

Guest

Hi, Peter.
What am I doing wrong?

vCalendarExport.VCS is not an executable file name. Therefore, DOS has no
way of running it. Outlook needs to be open in order to use this file, so
that the Shell command can be used to pass the path and file name to Outlook.
Try the following:

Call Shell("C:\<PathToOffice>\Outlook.exe /vcal C:\vCalendarExport.vcs",
vbNormalFocus)

HTH.

Gunny

See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips.

(Please remove ZERO_SPAM from my reply E-mail address, so that a message
will be forwarded to me.)

- - -
When you see correct answers to your question posted in Microsoft's Online
Community, please sign in to the Community and mark these posts as "Answers,"
so that all may benefit by filtering on "Answered questions" and quickly
finding the right answers to similar questions. (Only "Answers" have green
check-marks.) Remember that the best answers are often given to those who
have a history of rewarding the contributors who have taken the time to
answer questions correctly.
 
D

Dirk Goldgar

PeterM said:
I have VBA code in a form that creates a .vcs file for importing into
the Outlook Calendar. All I need to do is call that .vcs file and
outlook will start up and ask to save the entry. It works fine
outside of Access. If I go to Windows Explorer and click on
vCalendarExport.vcs, an outlook calendar entry pops us and asks if I
want to save the entry.

However, when I run the vCalendarExport.vcs from within VBA code
using Call Shell("C:\vCalendarExport.vcs", vbNormalFocus) a dos
window opens and the message in the dos window says
"C:\vCalendarExport.vcs is not recognized as an internal or external
command, operable program or batch file."

What am I doing wrong? Any help would be appreciated.

You can't Shell to a document. If Mark's suggestion of
Application.FollowHyperlink doesn't work, you could try calling the
Windows ShellExecute API function instead, using the fHandleFile()
function posted here:

http://www.mvps.org/access/api/api0018.htm

But I don't know for sure that will work, since usually FollowHyperlink
works for registered file-extensions.
 

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