PC Review


Reply
Thread Tools Rate Thread

Create new blank document from Access

 
 
bdtmike
Guest
Posts: n/a
 
      10th Nov 2006
I need to create a new blank document (e.g. Word, Excel, etc) from
within VBA.
This is the equivalent to right clicking on the desktop and clicking
"New..."

Is there a shell API function that will let me do this?

 
Reply With Quote
 
 
 
 
Norman Yuan
Guest
Posts: n/a
 
      11th Nov 2006
You can do that through ActiveX automation:

Dim xls As Excel.Application
Dim wd As Word.Application
Dim wk as Excel.Workbook
Dim doc As Word.Document

'Start Excel and open a new Workbook
Set xls=New Excel.Application
xls.Visible=True
Set wk=xls.Workbooks.Add("[Path to an Excel workbook template"])

''Start Word and add a new document
Set wd=New Word.Application
wd.Visible=True
Set doc=wd.Documents.Add("[Path to an Word document template"])

'Do something with the new workbook and the new document

wk.Close True
doc.Close True

xls.Quit
wd.Quit


"bdtmike" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>I need to create a new blank document (e.g. Word, Excel, etc) from
> within VBA.
> This is the equivalent to right clicking on the desktop and clicking
> "New..."
>
> Is there a shell API function that will let me do this?
>



 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
how do I create a blank HOrizontal Document? nico23 Microsoft Access 2 12th Jan 2010 03:13 AM
Automatically create a 20 blank page document Walter Microsoft Word Document Management 6 30th Oct 2009 12:58 AM
why can't I create a blank new document for multi lables =?Utf-8?B?c2tydXNrYQ==?= Microsoft Word Document Management 1 7th Sep 2006 06:46 PM
can not create new Blank document =?Utf-8?B?bW9vbmV5ZXNfc2lyZW5uYQ==?= Microsoft Word Document Management 1 26th Aug 2004 01:53 AM
Create a new blank document William Crook Windows XP General 4 29th Feb 2004 01:54 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:06 AM.