|
Hi Lew, I
know you needed this about 5 hours ago, but just in case you still need it,
give this a go. The intent
of this little snippet of code it to open a spreadsheet using DDE through VB,
and to update a couple of cells of the spreadsheet with a value, and then to
save and close the file. To make this
work, start a new project, and add a reference to the Microsoft Excel Object
Library by taking the following menu options. ' Project à' Add Reference Locate the
“Microsoft Excel object library”
mine is Microsoft Excel object Library 9.0, yours might be something different. Here’s the
amazing code Dim xl As
Excel.Application Dim wb As
Excel.Workbook Dim ws As
Excel.Worksheet Set xl =
New Excel.Application ‘ Set wb =
xl.Workbooks.Open("C:\test.xls") ‘use could use a file open dialog , or INI file to
supply the file name and location if you wanted. Set ws =
wb.Worksheets(1) ‘ the #1
means sheet one, you could use
this to work with multiple sheets within one file. ‘ This is
a pretty simple example, but I’m sure you can see the possibilities ws.Cells(1,
2) = "1" ‘ the value of
row 1, column two will now be “1” for I = 2
to 100 ws.Cells(i, 2) = "Lew is one hell of a great
guy!" ‘ Rows 2 through
101 will now have a statement that you can use over and over again when in need
of self affirmation. Next i wb.Close
True passing the “True”
with the close statement tells excel to save before closing. xl.Quit End Sub So, is
this closer to what you were looking for? Paul -----Original
Message----- Hey
guys, little help over here… I have
been asked to come up with a quick script that would allow the printing of Excel docs with sequential numbers. I
have been working on this since mid morning. I
researched for a way to do it in EXCEL alone, but was unsuccessful in finding a
way. My
solution: A
script that will supply the starting number, the print the Excel doc using this
number, then the script will increment the number, and print the Excel doc,
etc, etc. The
issues are that I cannot find anyway to pass a parameter to Excel; it doesn’t
have that type of argument. So I
went to an alternate. I created a Word doc, and put the starting number in
there, then, through Excel, I linked the number as an object. Manually, I can
get the number to change EXECEPT if I delete the number, I cannot manually type
in any numbers between the object brackets. I have to start at the next to last
digit, enter a the next sequential digit, then delete the last digit. And I
don’t know that I can do that fine a tuning with BWS yet. Yes,
this is just a sequentially numbered spreadsheet that is being printed to take
an inventory. The sequential numbers are currently being hand stamped (very
slowly). I need
this in about an hour and a half from the time of this writing. Has any
one produced such a thing (via BWS or otherwise). (I have to say that I have
had a hard time ‘learning’ how to deal with a windows application and BWS; I
have only worked with the Meditech stuff in the past, and I am trying to Shell
the Excel app, and write to the Word app, and print the Excel sheet). All
suggestions except “what are you, nuts?” accepted. TKs |
- [Talk] Help! - CRUNCH TIME Lew Hundley
- RE: [Talk] Help! - CRUNCH TIME Paul
- RE: [Talk] Help! - CRUNCH TIME Paul Donoughe
- RE: [Talk] Help! - CRUNCH TIME Lew Hundley
- RE: [Talk] Help! - CRUNCH TIME Paul Donoughe
- Re: [Talk] Help! - CRUNCH TIME JCurtiss
- RE: [Talk] Help! - CRUNCH TIME Lew Hundley
- RE: [Talk] Help! - CRUNCH TIME Lew Hundley
