vba courses london - opening word doc excel
The UK's Number 1 for Microsoft Office Training Add this page to your favourites/bookmarksBookmark page
 
View printable version of pagePrintable version
Plus One Google
Customer: Sign in
Delegate: Sign in
Trainer: Log in

Forum home » Delegate support and help forum » Microsoft VBA Training and help » vba courses london - Opening a word doc from excel using %USERPROFILE%

vba courses london - Opening a word doc from excel using %USERPROFILE%

resolvedResolved · Low Priority · Version Standard

replyReply Tue 16 Jan 2007, 11:04Delegate Julian said...

Julian has attended:
Excel VBA Intro Intermediate course

Opening a word doc from excel using %USERPROFILE%

Good day to you,
I distribute an exe program every now and then that puts excel & word files into the C: . However we have recently had our administration rights removed. I am however allowed to distribute this into ?CorD?:\Documents and Settings\?persons name?\My Documents .

My excel macro used to read:
Dim wrdApp As Word.Application
Set wrdApp = CreateObject("Word.Application")
wrdApp.Visible = True
wrdApp.Documents.Add Template:="C:\Pricing Program\30XA autoquote.dot"
wrdApp.Documents(1).Fields.Update
I tried
Dim wrdApp As Word.Application
Set wrdApp = CreateObject("Word.Application")
wrdApp.Visible = True
wrdApp.Documents.Add Template:="%USERPROFILE%\30XA autoquote.dot"
wrdApp.Documents(1).Fields.Update

It sadly doesn't recognise ":="%USERPROFILE%\30XA autoquote.dot" ....have you any ideas.

All the best
Julian


For upcoming training course dates see: Pricing & availability

replyReply Fri 26 Jan 2007, 11:37Trainer Andrew said...

RE: opening a word doc from excel using %USERPROFILE%

Hi Julian

Thanks for your enquiry. It sounds like it might be more helpful to have a conversation with you regarding how you are using the code in your environment, especially as the permissions have changed recently.

I will contact you directly to see if this is something that would be helpful.

Kind regards,

Andrew

 

Vba tip:

Stop Screen Flickering When Running Code

Running VBA code may cause the screen to flicker as the monitor is the slowest part of the program and cannot keep up with the very fast changes taking place.

To switch off the screen until the program is run enter the following code line:

Application.ScreenUpdating = False

The screen comes on automatically on completion of the program.

View all VBA hints and tips


Microsoft Certified Partner Accredited Training Provider: Institute of IT Training Institute of Leadership and Management - Certified Courses Security Seal verified by visa, mastercard securecard