开发者

How to launch one other program with VBA code?

I'm trying to launch another program install in my system from my Access application. Or to open another file from Access, how can I do it?

开发者_Python百科

EX: There's a file barcode_12mm.lbl, I want to use VBA code to launch it in one program that edits this bar-code label file.

Thanks!


You have multiple alternatives in Access:

  1. Shell() (see the Help file)

  2. Application.FollowHyperlink (see the Help file)

  3. ShellExecute() -- access.mvps.org/access/api/api0018.htm

The first requires you to know the path of the executable you are calling and is generally kind of fussy about getting the arguments properly formatted (you'll need double quotes for arguments with spaces in them, for instance).

The last two are for registered applications, such that if the file extension has an association defined, it will open the application associated with it. FollowHyperlink is easier, but ShellExecute provides more options.

ASIDE:

Note that many people think that using barcodes in Access requires an outside program or an ActiveX control. Barcodes are just fonts, so if you understand the format of the barcode encoding, it's really simple to just create your own barcodes within Access and not worry about any outside dependencies. Tony Toews has an article rounding up lots of information on the subject.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜