PC Review


Reply
Thread Tools Rate Thread

Create new spreadsheet based on template from macro in Word

 
 
Angie M.
Guest
Posts: n/a
 
      17th Feb 2010
Hello,

I am trying to put my Excel templates on a menu in Word along with my Word
templates, hoping that I can create a new spreadsheet based on my Excel
template. I have these two macros which I have tried with no luck:

Sub Tryit()

Dim xlApp As Object
Dim xlWB As Object
Dim xlWS As Object
Dim cRows As Long
Dim i As Long
Set xlApp = CreateObject("Excel.Application")
Set xlWB = xlApp.Workbooks.Add("C:\Program Files\Microsoft
Office\Templates\Timetable\Rule16 fed.xlt")
Set xlWS = xlWB.Worksheets(1)

End Sub

Sub tryitagain()

Dim xlWB As Object
Dim xlWS As Object
Dim cRows As Long
Dim i As Long
Set xlApp = CreateObject("Excel.Application")
Set xlWB = xlApp.Workbooks.Add(Template:="C:\Program Files\Microsoft
Office\Templates\Timetable\Rule16 fed.xlt")
Set xlWS = xlWB.Worksheets(1)

End Sub

I'm using Word and Excel 2003. Can anyone help me? Thanks for your time.

 
Reply With Quote
 
 
 
 
Joe
Guest
Posts: n/a
 
      17th Feb 2010
Hi Angie

Probabli Excel is open, but invisible.

Try to include the followin statement:

xlApp.Visible = True

Bye

Joe

"Angie M." <(E-Mail Removed)> escreveu na mensagem
news:83335893-6FDA-4464-A8E3-(E-Mail Removed)...
> Hello,
>
> I am trying to put my Excel templates on a menu in Word along with my Word
> templates, hoping that I can create a new spreadsheet based on my Excel
> template. I have these two macros which I have tried with no luck:
>
> Sub Tryit()
>
> Dim xlApp As Object
> Dim xlWB As Object
> Dim xlWS As Object
> Dim cRows As Long
> Dim i As Long
> Set xlApp = CreateObject("Excel.Application")
> Set xlWB = xlApp.Workbooks.Add("C:\Program Files\Microsoft
> Office\Templates\Timetable\Rule16 fed.xlt")
> Set xlWS = xlWB.Worksheets(1)
>
> End Sub
>
> Sub tryitagain()
>
> Dim xlWB As Object
> Dim xlWS As Object
> Dim cRows As Long
> Dim i As Long
> Set xlApp = CreateObject("Excel.Application")
> Set xlWB = xlApp.Workbooks.Add(Template:="C:\Program Files\Microsoft
> Office\Templates\Timetable\Rule16 fed.xlt")
> Set xlWS = xlWB.Worksheets(1)
>
> End Sub
>
> I'm using Word and Excel 2003. Can anyone help me? Thanks for your time.
>



 
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
Can I create a Word-based XML "template"? IDRincon Microsoft Word Document Management 0 8th Aug 2008 06:17 PM
how to create and use a new spreadsheet based on a template =?Utf-8?B?U2hhZHk=?= Microsoft Excel Misc 3 3rd Apr 2005 09:50 PM
automatically create another spreadsheet from template Joshua Microsoft Excel Misc 2 12th Nov 2003 10:33 PM
automatically create another spreadsheet from template Joshua Microsoft Excel Programming 0 12th Nov 2003 09:35 AM
How to create a Word XML file based on a template and fill it with user input??? Daniel Walzenbach Microsoft VB .NET 7 29th Oct 2003 08:35 AM


Features
 

Advertising
 

Newsgroups
 


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