Wrox Programmer Forums
|
VB How-To Ask your "How do I do this with VB?" questions in this forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 26th, 2004, 09:00 AM
Registered User
 
Join Date: Apr 2004
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default adding VBA code to VB

I'm quite new to VB and I am trying to create a program that requires a line of VB code and a line of VBA code to do what it needs to do.

basically, I need to launch microsoft word, then run this VBA code:
Options.DefaultFilePath (wdWorkgroupTemplatesPath) = "\\server\share\workgrouptemplates"

the trouble is, it isn't recognizing the syntax for the vba stuff. I was wondering if I need to preface that code with some kind of switch or introduction that tells vb we're speaking in VBA now.

thanks!!!!

 
Old April 27th, 2004, 02:27 AM
Authorized User
 
Join Date: Aug 2003
Posts: 44
Thanks: 0
Thanked 0 Times in 0 Posts
Default

In can add a reference to the word object library. (Project/References)

Then you can do the following:

Dim woApp as new Word.Application

set woApp = CreateObject("Word.Application")

If you typ woApp. you should get the available functions.

Greetz

Tom.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Adding Records with VBA rohit_ghosh Access VBA 7 June 22nd, 2007 05:05 AM
Code works in Excel VBA but not Access VBA fossx Access VBA 2 May 21st, 2007 08:00 AM
Why does Excel VBA code run faster than VB? mambojedi Pro VB 6 3 April 24th, 2006 02:48 PM
convert vba code to vb tommy03 VB How-To 3 February 23rd, 2005 02:13 PM
Adding or updating record using VBA egivler Access VBA 0 August 31st, 2004 11:06 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.