Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / April 2005

Tip: Looking for answers? Try searching our database.

Using an ASK Variable in Macro

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Steve - 26 Apr 2005 17:59 GMT
Hi,

I have a template I have been working on for some time now.  I have
run into a snag.  I am using a combo box with a macro attached that
will insert the appopriate file from a specified drive and path when
chosen from the drop down. This uses the INCLUDETEXT field.

This template and subdocuments will be located in different drives and
folders on each users computer.

To change to INCLUDETEXT field to the correct path I have inserted an
ASK field to run when the document opens, it then takes this result
(variable) and inserts it in the INCLUDETEXT fields which I have
modified. This works great with the one problem.

The macro that I am using for the drop down box inserts the file with
a drive and folder path. I have tried to use the same ASK result
(variable) to put in place of the path but it doesn't like this.

Is there any way I can use the result of an ASK in a macro? Or is
there some other way. Some other field that will work in both the
document and a macro.

What I have now works fine and updates all my includetext fields no
problem.  I just can't get the macro to use some type of variable that
the user types in when the document opens.

Regards
Steve
Doug Robbins - 27 Apr 2005 12:01 GMT
If you want to obtain information from the user for use with a macro, you
should use an InputBox.  In this case however, it is probably more
appropriate to use the Dialogs.wdDialogInsertFile.Show command as that will
display the insert file dialog and allow the user select the file to be
inserted.

Signature

Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

> Hi,
>
[quoted text clipped - 25 lines]
> Regards
> Steve
Cindy M  -WordMVP- - 28 Apr 2005 12:47 GMT
Hi Steve,

Difficult to determine exactly what problem you're running into, since
you don't specify in what WAY your solution isn't working. My first
thought would be that the user isn't typing double-backslashes for the
file path you're substituting into IncludeText? Or that you have a
version of Word that requires single, rather than double-backslashes
when the path comes through a field?

FWIW, when I need something like I understand you're doing, I'll keep
the file path in a document PROPERTY (File/Properties/Custom) and change
the property, using a DocProperty field in the InsertText field.

> I have a template I have been working on for some time now.  I have
> run into a snag.  I am using a combo box with a macro attached that
[quoted text clipped - 20 lines]
> problem.  I just can't get the macro to use some type of variable that
> the user types in when the document opens.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question
or reply in the newsgroup and not by e-mail :-)
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.