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 / August 2007

Tip: Looking for answers? Try searching our database.

Macro to insert file, pause, get response, act on response

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
jerem - 22 Aug 2007 17:08 GMT
I'm trying to write a macro which will insert a file (varying files from a
document management system - Imanage), pause and wait for the user to input
the document number and then act on the user's response.  Can't seem to get
that code using the Macro Recorder in Word - don't know how to tell it to
pause and wait for a response from the user.  Any help would be appreciated.
Jonathan West - 23 Aug 2007 00:23 GMT
> I'm trying to write a macro which will insert a file (varying files from a
> document management system - Imanage), pause and wait for the user to
[quoted text clipped - 4 lines]
> pause and wait for a response from the user.  Any help would be
> appreciated.

Use the InputBox function. Look it up in the VBA Help

Signature

Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup

jerem - 23 Aug 2007 01:30 GMT
I did look it up, however, it's like I now have the verb with no nouns and
adjectives (or vice versa) to form a complete sentence.  My VBA is extremely
limited.  I generally try to get as much code generated through the Recorder
in Word, or I scavenge this site for pieces of code that I can decipher and
tweak to fit my needs - whether or not the code is efficient - if I get it to
work, it's good enough for me -- which leads to this question - can you
recommend a good book which covers VBA in the Word environment.  There is a
book by Steven Roman called Word Macros - are you familiar with this book or
do you have any suggestions?

Thanks for your help and response.

> > I'm trying to write a macro which will insert a file (varying files from a
> > document management system - Imanage), pause and wait for the user to
[quoted text clipped - 6 lines]
>
> Use the InputBox function. Look it up in the VBA Help
NZ VBA Developer - 23 Aug 2007 02:32 GMT
G'day jerem!

Can't help you with your main question, but as for a reference guide to VBA,
Steven Roman's book is about the only one out there - other than a couple of
'Idiot's/Dummies' guides. Reviews on it have been mixed - search Amazon to
see what I mean - but I quite like it. It's the book I started with, and
between it, the macro recorder and the VBA help, I've become quite
proficient. (I also did an intro to Word macros course at the local polytech,
but I knew more than the instructor.) I haven't spent a lot of time on the
MVP sites, but what I have seen looks very good. And then there is always
this forum - thanks everyone!

Of course it helps to have a bit of exposure to programming in general,
altho in my case, that was a couple of intro classes at uni 20-mumble years
ago (BASIC & FORTRAN - eek!). Even so, I'm not a programmer; my forte is
technical writing, and my interest in VBA came about from necessity and the
desire to work more efficiently.

My advice: get the book, keep doing what you're doing and adopt the Kiwi
philosophy - Give it a go! She'll be right, mate!

Signature

Cheers!
The Kiwi Kode

> I did look it up, however, it's like I now have the verb with no nouns and
> adjectives (or vice versa) to form a complete sentence.  My VBA is extremely
[quoted text clipped - 7 lines]
>
> Thanks for your help and response.
Greg Maxey - 23 Aug 2007 03:32 GMT
Maybe something like this will do:

Sub ScratchMacro()
Dim pName As String
Dim oRng As Word.Range
Dim Source As Document
With Dialogs(wdDialogInsertFile)
   .Display
   pName = WordBasic.FilenameInfo$(.Name, 1)
End With
Set oRng = ActiveDocument.Range
oRng.Collapse wdCollapseEnd
oRng.InsertBefore (InputBox("Enter the file number:  ") & vbCr)
oRng.Collapse wdCollapseEnd
oRng.InlineShapes.AddOLEObject FileName _
       :=pName, LinkToFile:=False, DisplayAsIcon:=False
End Sub

Signature

Greg Maxey/Word MVP
See:
http://gregmaxey.mvps.org/word_tips.htm
For some helpful tips using Word.

> G'day jerem!
>
[quoted text clipped - 30 lines]
>>
>> Thanks for your help and response.
Graham Mayor - 23 Aug 2007 08:44 GMT
I knew you couldn't stay away for long ;)

Signature

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor -  Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>

> Maybe something like this will do:
>
[quoted text clipped - 48 lines]
>>>
>>> Thanks for your help and response.
jerem - 25 Aug 2007 04:40 GMT
Hi Greg,

Tried your code - some very weird things happen though.  First problem is it
only looks to non-network areas (i.e., c drive, desktop, etc) - will not let
me insert a file from Imanage (my company's document management system).  
Second and here's where the weird stuff begins - even if you select a
document from the local drive, it brings that document in as a Picture (first
weird thing) and it does so as a document within a document (second weird
thing) and the name will read something like:  Document in Document 4.

I then tried to do an Object,  Convert to Word, but that does not work.  
What goes on with this macro - very, very strange.  But thanks for trying to
help.

> Maybe something like this will do:
>
[quoted text clipped - 48 lines]
> >>
> >> Thanks for your help and response.
Greg Maxey - 25 Aug 2007 06:20 GMT
I don't really know anything about your companies file management system.  I
was just trying to show you how to insert a InputBox that requires the user
to enter some data before the file is acutally inserted.  The wierd things
are probably do to the fact that the file is inserted as an object (not just
text).

Signature

Greg Maxey/Word MVP
See:
http://gregmaxey.mvps.org/word_tips.htm
For some helpful tips using Word.

> Hi Greg,
>
[quoted text clipped - 70 lines]
>>>>
>>>> Thanks for your help and response.
NZ VBA Developer - 26 Aug 2007 23:00 GMT
jerem,

I've had a bit of experience with iManage/Interwoven, and altho I can't give
you an answer that explains everything that's happening, I do know that
you'll struggle to retrieve a document from iManage's store. iManage security
pretty much only lets iManage have access to it, so even if you have the
document ID you just won't be able to get there from here. (The document ID
is really just a pointer in a SQL database that tells iManage where to look;
the actual filename probably isn't even remotely the same.) The only way I
know of to work with stored documents is to use the native iManage
functionality to save a copy of the document locally and then perform any
operations using the local copy.

It appears from your original post that you want to drive the iManage
interface using VBA. I can just about guarantee that you won't have much joy
there as the iManage API isn't exposed enough to allow VBA to run it - and
the part that is exposed is pretty arcane. The best I've been able to do is
minor tweaks to the iManO2K template (the one that links Word and iManage) to
fine tune the auto-profile process a bit.

If it's critical that you be able to do what you're trying to do, talk to
your friendly Interwoven engineer about a bit of custom development - and
then be prepared for a bit of 'sticker shock' when you get the quote. ;-)
Signature

Cheers!
The Kiwi Koder

> Hi Greg,
>
[quoted text clipped - 9 lines]
> What goes on with this macro - very, very strange.  But thanks for trying to
> help.
jerem - 27 Aug 2007 00:00 GMT
I figured as much.  Am automating certain operations I have to do within a
document, however, previous to even doing that I have to either copy or
insert certain other documents.  Thought it would be even more efficient to
address that step within the macro as well.  So, it's not critical that I do
it - just thought it would save even more time if I could accomplish that as
well in one sweep.  Thanks for the info.

> jerem,
>
[quoted text clipped - 33 lines]
> > What goes on with this macro - very, very strange.  But thanks for trying to
> > help.
jerem - 23 Aug 2007 05:34 GMT
G'day NZ VBA Developer,

Ditto to most of what you wrote - I took computer programming back in the
day - won't tell you what day - that will age me but you'll probably figure
out once I list languages -  took a course in Assembly language and Cobol -
and when you had to keypunch your code in.  So am aware of Ifs, Thens, Loops,
etc.  but have not used much VBA so don't know how to speak that language
yet.  Will take your advice then and get the book.  Need to learn to speak
the language since I, too, have the need to work more efficiently.  Thanks
again for the advice.

> G'day jerem!
>
[quoted text clipped - 28 lines]
> >
> > Thanks for your help and response.
 
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.