|
-
Aug 18th, 2000, 09:17 AM
#1
Thread Starter
Member
Anyone know where I mght find some code which shows me how to open up an excel template (xlt) in code, write values into a specific worksheet and then save it as an xls file?
-
Aug 18th, 2000, 10:08 AM
#2
Addicted Member
Try the macro recorder......
Steve
-
Aug 18th, 2000, 10:28 AM
#3
_______
<?>
Code:
' I don't have a lot of experience in excel but I've
' handled littel jobbies like this
' I create a macro to do my excel work for me
' I then would call the file holding the macro
'
' of course if you need to enter information gathered
' on the fly throught your app and write it in this
' macro business is not what your are after
'
' then I would run this from my VB Application
'
'create and object (Excel SpreadSheet)
Dim oXL As Object
Set oXL = CreateObject("Excel.Application")
' Open the workbook that contains the macro to run.
oXL.Workbooks.open "C:\Folder\MyFile.xls"
'
'as object opens invisible, make visible if needed, if not omit
'the line oXL.visible=true
'
oXL.Visible = True
'
' Run the macro.
oXL.Application.Run "MyFileName.xls!MyMacroName"
'
' Quit Microsoft Excel.
oXL.Quit
'
' Free the object from memory.
Set oXL = Nothing
'
"A myth is not the succession of individual images,
but an integerated meaningful entity,
reflecting a distinct aspect of the real world."
___ Adolf Jensen
-
Aug 18th, 2000, 05:28 PM
#4
Frenzied Member
One problem with using a macro imbedded within Excel is that it gives the standard, pain-in-the-butt, dialog box about Virii. If you're using Excel in hidden mode or if you're opening and closing a lot of workbooks, it becomes a nuisance real fast. The best thing to do, in this instance is move the macro into your VB code, making sure you set the appropriate objects when you modify the macro to make it work with VB.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|