Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    Visual Basic




Can An Excel Spreadsheet By Accessed By VB6?


This whole question is probably stupid but:

Can an Excel spreadsheet by accessed by VB6?

I mean without using Shell and Sendkeys. This is stupid but - "SAY" ...... String = (C:myspreadsheet.xls.Cells(1,1).value)

If true - can 255 access an Excel spreadsheet at once like a data-base (for read only)?

Just curious.... I know nothing about databases and VB6... I'm really only trying to do something that seems simple (my other question in the db forum):

------------------------------------------------------------------------

I've never played with VB6 and database files.... I've been browsing through the tutorials by Karl, but I'm missing specifically what I'm looking for.

Basically, I have an Access97 database at work with 5 tables.

I just need to be able to "read" and search the information. Really, just like you would use an array....

I want to access one table at a time and load all the column 1 cells in to listboxs. Then, if the data in the listbox is selected, I want to search through the table until the "data" is found and then read different cells in that row/record depending on what's going on (completly transparent to the user).

This is for a stand alone VB6 app, but (as an example) if it was for an Excel VB Script I would be doing something like:


VB Code:
Sub_LoadListBox_click() LastCol = Cells.Find(What:="*", _      SearchDirection:=xlPrevious, _      SearchOrder:=xlByColumns).Column For X = 2 to LastCol  MyListbox.additem Cells(X,1).valueNext X End Sub '---------------------------------------- Sub Button_click()For X = 0 To MyListbox.ListCount - 1    If MyListbox.Selected(X) = True Then TempStr = OfficListBox.List(X)Next X Worksheets("MyWorksheet").activate LastCol = Cells.Find(What:="*", _      SearchDirection:=xlPrevious, _      SearchOrder:=xlByColumns).Column TempNumber = 0For X = 2 to LastCol  If Cells(X,1) = TempStr Then      TempNumber = X      Exit For  End IfNext X If TempNumber = 0 Then Exit Sub MyNameStr = Cells(X,1).valueMyNumberStr = Cells(X,2).valueMyAddressStr = Cells(X,3).Value'(blah blah)End Sub


Thanks for any help!




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Excel - When Userform Visible, Excel Menu Unable To Be Accessed
I have an excel template that has a pop-up userform to enter different types of data. The issue is, when the form is open, I can no longer access the excel menu-bar. I would like to have this ability so that the user may copy and paste and infomation that maybe on another workbook open in the same window. How do I get this access back when the form is open?
Thanks,

Excel Spreadsheet From FTP To Customized Excel Spreadsheet
Hi guys!!

Help on this PLEASE!!

I get an EXCEL SPREADSHEET via FTP. I want to take that xls file and convert it to my own format which is ALSO an xls file. How can I do that? I went through your forums but cannot find what I am looking for. Basicly want to push a button and it must take the "rough" xls and create an new xls with the data "neat" so that I can use it.

For example the original xls has nonsense at the bottom and top like a address and names that I do not use, ONLY the "Item Codes" and "Item Description". Luckily the "Item Codes" and "Item Description" is in one column.

Invalid Data In Excel Spreadsheet/count Group Of Items In Excel Sprdsh
Please help:
Problem#1:
I populated an excel spreasheet with data from access table, using CopyFromRecordset function.  The process was successful and all the fields displayed correctly in the spreadsheet, except the date field which displayed:"########".  What did I do wrong?

Problem#2:
What vb code can I used to count group of items in the spreadsheet.
Any insight will be very helpful.
Thanks,
C.

Working With Excel Spreadsheet (*Resolved*No Excel Solution)
I haven't done any of this before, so I'm a bit stuck.
I need to create a small app that will allow the user to enter an item number, click find, and display the recordset to the user on a form. The info is stored in an excel spreadsheet. I would have done it using Access, but the user is across the country, doesn't have Access, and needs this thing by this afternoon.
Can anyone point me to something that will give me some VBA tips, or some instruction on how to do this?
I always seem to get install/access errors when I use Access db's, and with the guy being on the other side of the country, I want to avoid trying to work out all those problems. This should be a simple task, but I'm on a totally different train of thought program wise and can't seem to get into this Excel thing.

Thanks in advance.

Excel Spreadsheet
Code:
ChDir "C:WINDOWSDesktopDailyreport"
Workbooks.OpenText Filename:="C:WINDOWSDesktopDailyreport123.txt.TXT", _
Origin:=xlWindows, StartRow:=1, DataType:=xlDelimited, TextQualifier:= _
xlDoubleQuote, ConsecutiveDelimiter:=True, Tab:=True, Semicolon:=False, _
Comma:=False, Space:=True, Other:=False, FieldInfo:=Array(Array(1, 1), _
Array(2, 1), Array(3, 1), Array(4, 1), Array(5, 1), Array(6, 1), Array(7, 1), Array(8, 1), _
Array(9, 1), Array(10, 1), Array(11, 1))
I am saving daily information into separate textfiles and am building an excel interface so that a user can choose 3 or more days to build a graph..so now I need to put the textfiles into an excel workbook.
The above code will open up a text file and place it perfectly into its own excel workbook....but what I really want to do is.
Open up several of these text files and place them all into the same workbook (the one I am creating these from).
So that each textfile will go into its own spreadsheet in my workbook.
Any suggestions would be appreciated.

Non Excel Spreadsheet
I would like to find a control that is similar to a spreadsheet that allows me to edit any column. I found out that the listView or whatever it is called only allows you to edit one column. I do not want the users to have to have Excel. I also would prefer a small DLL if it is required. I guess I could design my own, but I think a pre-made control would make life much easier. Thanks.


http://www.xtremevbtalk.com/show...ht=spreadsheet

http://www.google.com/search?q=-Exce...&start=10&sa=N

EXcel Spreadsheet From VB
Hi
I have the following problem :
I have embedded a exel ole object in one of my forms.
Now within my program I turn it into a Ole Automation object.
eg. dim exelobj as object
set exelobj as OLE1.object
I then populate the neccessary cells.

all works fine up to this point.

I then try to save the exel sheet using the following command exelobj.worksheets(1).saveas "test.xls". It creates the exel file but the file is blank.

please help

Excel Spreadsheet In Vb6
I need to disable the right click menu at runtime on a spreadsheet. i am able to set the menu as read only, but how do completely remove the menu?

help

Excel Spreadsheet && VB
Hello to everyone:

I am very new at VB and programming. I am taking accounting and also, looking at taking programming while in school. At the moment, I am trying to create a simple function in an excel workbook. I wanted to use a listbox in a merged cell b8 to d8. With the choice being Worksheet (1), then the only other item in the listbox would be Worksheet(2). I wanted the listbox to show the list Worksheet (1), Worksheet (2). Action would be when you clicked on one Worksheet (1) it would show Worksheet(1) and then if you clicked on Worksheet (2) you would have the second worksheet show. I wanted the individual to be able to see the listbox when they opened the workbook. I am having a heck of a time getting the listbox to show any items in it in Excel. It is there and can't even click on it. I have tried while using the VBEditor in Excel putting this command in the Module, userform or any other place even on the listbox click(). I can not get it to show let alone work. I was wondering if any one would know or could help me here. I have even tried the groups from MS Office usergroup and instead get no answers and alot of spam to my email account.

With Worksheets(1)
Set lb = .Shapes.AddFormControl(xlListBox, 100, 10, 100, 100)
lb.ControlFormat.ListFillRange = "A1:A10"
End With


any help would be greatly appreciated.

Pamela

Import An Excel Spreadsheet Into Excel
Hello
Here is another basic Excel question that I did not see the answer to in FAQ's or Excel help. Anyway, does anyone know how to bring or import an Excel spreadsheet intp a current spreadsheet. Basically I'm just trying to combine the two into one workbook. thanks for any help

Hal

Converting An Excel Spreadsheet To A PDF Using VB?
Is it possible to use VB6 to convert my workbook object into a PDF if I have Adobe Acrobat?

The program generates 13 page reports in Excel and they are too easy for people too modify. The PDF file ends up being about 1/3 the size of the workbook also. I'd rather convert them to PDFs automatically.

Thanks.

Automating Excel Spreadsheet /w VB6
Dear Sirs,

I am a Newbie here (and to VB as well) and I am sure that this question has been asked before, but I couldn't find the references anywhere, so bear with me.

My problem is very simple: I need to be able to open an existing spreadsheet, look for an empty cell, take in data from the user, based on that automatically populate cells in the spreadsheet (iteration of the original data), and save it.

Then every time the user needs to open the spreadsheet via Vb6 app it would know the empty cell location automatically and allow the user to just enter the initial data values and how many new instances the user wants to be created on the spreadsheet this time.

I would be eternally grateful for all the possible help in this matter. Some example code would be fabulous, but anything really would help to just me me going with this. I have some programming experience, so I am not a total newbie, but I haven't doen much VB, so that's why I am here.

Thanks a bunch!

Populating Excel Spreadsheet From VB6
Hey everyone,

Okay this has me a little frustrated. I am able to open Excel, write values to certain cells, save & close the spreadsheet. However, that's not exactly what I need to do.

First off, I'm writing this in VB6, not VBA. The application itself is quite complicated and couldn't be done in VBA unfortunately.

The part of the project that relates to my problem is as follows:

- I have 2 combo boxes in a VB6 project.

- When the user clicks a "POPULATE" button, I need to copy the info from the VB6 comboboxes to MS-Excel. (both combo boxes go in different cells on row 1)

- When the user changes the values in the comboboxes, then hits "POPULATE" again, it will copy the values to row 2, and so fourth.
(so it needs to be able to find out the last row with information, and put info in the following row.)

- The Excel spreadsheet should always be open.. so there's no need to close it everytime values are written to it. Just need to find the spreadsheet that is open (if it's not open, then open it... and leave it open)

I know this has been done before, but I couldn't figure out how to do it for the life of me... kinda frustrating.

I don't expect to get exact code or anything.. but some information or a URL that can help me would be greatly appreciated.

Thanks anyone for your help,

+++ath0
NO CARRIER

Saving An Excel Spreadsheet In VB
Hi,

I am opening an excel file for editing and saving it as another filename.
What I need is: if the other filename already exists, can I overwrite it automatically without the user getting prompted with...."the file already exists, are you sure you wish to overwrite it....??

Is the following code the right way to go??

xlFile.ActiveWorkbook.SaveAs FileName:="Error File" & ".xls", _FileFormat:= xlNormal, Password:="", WriteResPassword:="", ReadOnlyRecommended:=True, _
CreateBackup:=False,...............????????????????????

Thanks in advance,

blaaboy

Connecting To An Excel Spreadsheet
greetings all, How can I connect to an excel spread sheet in visual basic? I actually had it working using ADOBC controll, but now for some reason it gives me an error which says the jet database engine canot find my record source. I am using the microsoft OLE DB provider for ODBC databases and I am using adCmdTable as my record source simply because I am not sure what else I should do for record source. The test connection is always successful but I just cant seem to get any data, should I try a different datacontroll or something? I just wish I knew why it used to work fine with ADOBC....

Excel Spreadsheet Graph
I have several spreadsheets that I need to graph but they are not exactly the same. Some have an extra row of data than others, so lets say that "widgets one" may be on row three in one spreadsheet - but on row two on the second spreadsheet. All the info I have on graphing this information gathers the data by a specific row (.Range("A1:B15")....so this will not work for me. Is there some way to query the row for "widgets one" on each spreadsheet, then query for "widgets two" on each spreadsheet....etc. like in an access table?

Need Help With Code For Excel Spreadsheet
Hello all, I'm new to using vB and especially in Excel. I've got Excel XP and am trying to use it to create a workbook for my Fantasy Football League.

The problem I'm having is arranging the standings week by week. The league has 2 divisions of 4 teams each and I would like the standing to display the team with best record at top of each division. Also, if two or more teams have the same record, they need to be displayed in order of points.

If anyone has any suggestions or comments, please post. I'll check asap and thanks in advance for any help.

rossboy69

Emailing An Excel Spreadsheet
Hi all.. in a I have a similar thing going on where the spreadsheet acts as a form.

It worked fine in Win 2000 but recently, the upgrade to XP and Office 2003 has meant some stuff has gone wrong.

I use the ActiveWorkbook.SendMail call from within Excel so it emails when you press a button in the spreadsheet. Then, as a backup confirmation, the item then appeared in your Sent Items folder (as you would expect it to).

Since the XP upgrade, it no longer goes into the Sent Items which was a necessary part of the step.. Does anyone know what has gone wrong?

Emailing An Excel Spreadsheet
I've created a spreadsheet that populates cells based on information stored in a data file. Once the macros/code have done the business and populated all the relevant fields I want to be able to automatically email the excel spreadsheet to various people who require this information

Is this possible?

Any help would be much appreciated

Is Excel Spreadsheet Already Open
Hi,

Im using VB to automate the generation of excel spreadsheets, however I need to put a check in to test if a user enters the name of a new spreadsheet, I want first to validate that it may already exist, then to check to see if someone had got it open.

Does anyone have any ideas on how to check if a spreadsheet is in use?

My inital thoughts where trying to use xlApp.Workbooks.open(Filename) and maybe trapping an error if its read only but this doesnt seem to work, unless Im missing something.

Thanks in advance for any help!

Need VB Tweak For Excel Spreadsheet
I need to copy a range of data to a user defined spreadsheet and tab via a message box. I know I'm way off at this point, and I would appreciate any help. Thanks -Herrtodd


Code:
Sub copydatatosummary()
'copys all pending leaks to user defined spreadsheet and tab

Range("A1:F100").Select 'this is the total leaks range
Selection.Copy
MsgBox "What spread sheet and tab would you like to copy to"

Range("A1").Select
ActiveSheet.Paste
Application.CutCopyMode = False
Range("A1").Select


End Sub

Need VB Tweak For Excel Spreadsheet
Hi all,
I looking for a solution here, to stop the Sub when no i/h is found. A message box would be great like "no i/h found End ok". Thank you HerrTodd
Sub Findvalueandhighlightrow()
Dim ZoekIn As Range, Vind As Range
Dim celtel As Range, Wat As String
'Removes in house leaks from top of spread sheet

Wat = "i/h"
Set ZoekIn = Columns(4).Find(Wat) 'look in column 4 for "i/h"
If celtel Is Nothing Then
Set celtel = ZoekIn
End If
If Not ZoekIn Is Nothing Then
Set Vind = ZoekIn
Do
Set celtel = Union(celtel, ZoekIn.EntireRow) 'for each "i/h" found add it to the union
Set ZoekIn = Columns(4).FindNext(ZoekIn)
Loop While Not ZoekIn Is Nothing And ZoekIn.Address <> Vind.Address
End If
PROBLEM ZONE If no i/h is found it still tries to select, but I need Sub to terminate with message box "no i/h found"
celtel.Select 'and select all the rows in which "i/h" is found
Selection.Select
copyshighlight
'Range("A1").Select

End Sub

Frontend To An Excel Spreadsheet
Ok, I just received an assignment to add a frontend to an Excel spreadsheet, and automate it. I come from more of a Unix/C++/Perl background, so I've had to give myself a crash course in VB over the last few hours, and I don't know much about MS development tools. I do know how to do VBA macros.

So my question is this:
What is the earliest version of Visual Basic that will allow me to create a standalone app that can open an Excel spreadsheet (Excel XP, no special formulas though), manipulate it, and save it?

Thanks in advance,
--TG

Converting Excel Spreadsheet To SQL
I need to write a little application in VB6 that can import an excel spreadsheet and append it to an existing table in SQL server. I have looked all around for a good starting point on this with no luck. Would appreciate someone pointing me in the right direction. Thanks.
Tim

SQL Query To Excel Spreadsheet
Hi,

I was wondering how you might go about transfering a query you have just created to a exsiting Excel spreadsheet?

Any hints, tips or advice would be welcome!

Thanks in Advance.

VB + Creating Excel Spreadsheet
I am creating a small program that export data to an excel spreadsheet, I want it to create a new spreadsheet each time. I keep getting the error:

Run-Time Error '1004'

'C: est.xls" could not be found. Check the spelling of the name, and verify that hte file location is correct.

The Code:

FileName = "C: est.xls"

Set xlApp = CreateObject("Excel.Application")
Set xlWb = xlApp.Workbooks.Open(FileName)
Set obj = xlApp.Application.Sheets.Add

Sheets(1).Name = "Daily Report"

I want just one sheet and want it named "Daily Report"

Thanks

Is Excel Spreadsheet Already Open?
My app runs fine (updating Excel spreadsheet from SQL200 db via VB6) unless the spreadsheet is already open. Then, VB opens it read only and it doesn't get updated.

I need to be able to see if the spreadsheet is already open. If so, send a message to the gal whio is running the updating app.

This is the pertinent area of the code. I won't bore you with all of it.

===============
'================================
Set rsJob = New ADODB.Recordset
'================================
sqlJobs = "SELECT * FROM JOBS WHERE [JOBNUMBER] = " & rs![jobnum]
sqlJobs = sqlJobs & " AND WORKBOOK IS NOT NULL"
rsJob.Open sqlJobs, CnxnTechSQL, adOpenKeyset, adLockReadOnly, adCmdText
If Not rsJob.BOF And Not rsJob.EOF Then
'open a workbook
If Len(rsJob![workbook]) = 0 Then
MsgBox "Job # " & rs![jobnum] & " has no workbook defined." & vbCrLf & "It will have to be updated by hand." & vbCrLf & "Write down the job number.", vbExclamation
rsJob.Close
Set rsJob = Nothing
'==================
GoTo continue
End If
'if not at last pass, don't update
'spreadsheet good prints
If rs![ENDPASS] < rsJob![PASSES] Then
rsJob.Close
Set rsJob = Nothing
'==================
GoTo continue
End If
'set workbook name
WorkBookName = WorkBookDir & UCase(rsJob![workbook]) & ".xls"
msg = "2 " '& WorkBookName

=====> this would be a good place to see if it is already open by another user.

Set xlBook = xlApp.Workbooks.Open(WorkBookName)
Else
MsgBox "Job # " & rs![jobnum] & " not found." & vbCrLf & "It will have to be updated by hand." & vbCrLf & "Write down the job number.", vbExclamation
rsJob.Close
Set rsJob = Nothing
'==================
GoTo continue
End If
rsJob.Close
Set rsJob = Nothing
'==================

================================

Unlock An Excel Spreadsheet
I am running the following subroutine in vb6.0 It copies the spreadsheet to the new name and directory but the spreadsheet is "Locked" I cannot edit it or unlock it or delete it. Is there something I missed in this simple piece of code that is keeping these copied .xls files locked? Thanks

Public Sub copy_files()
Dim fs
Dim sourcefname As String
Dim targetfname As String

sourcefname = TemplateDirectory & "template.xls"
targetfname = DataDirectory & "DUPE1_FILE.xls"

Set fs = CreateObject("Scripting.FileSystemObject")
fs.CopyFile sourcefname, targetfname

Set fs = Nothing
End Sub

Sizing An Excel Spreadsheet In VB
Hi,

I was able to put an excel spreadsheet in VB using OLE. The only problem is is that the data is being cutoff in VB. How do I make it to where it looks exactly like the spreadsheet in excel.

All I use right now is
OLE1.SourceDoc
OLE1.Action

I am new to this so any help is greatly appreciated.

Extracting Url From Excel Spreadsheet
Hi All,

I am creating an automation script and have need some assistance please.

Is it possible to extract a url from an excel spreadsheet and have it opened in the brower using VB6.
(I will the do some basic rendering checks) then automatically move to the next url in the spreadsheet.

Is this possible, i am new to VB.

Thanks

Translating VB To Excel Spreadsheet
I've used VB for quite some time now, but I've never used it to write subroutines in Excel with the built in Visual Basic editor. So, I have a question about how to translate what I want to do into Excel.

I have two columns in the spread sheet, one that lists dates and the other that lists certain codes (for instance, M1234). Beside theses are rows to the right that list the 12 months of the year and corresponding columns listing the ten different codes.

What I want to happen is, when a code is entered into the column on the left for codes, a counter will appear over to the right corresponding to the column for the code and the row for the month. At first it would be 1 of course, and increment every time that code was entered for that month.

I know how I could do this in regular VB, but I don't know how to translate it into Excel terms. What I would probably do in VB is have a bunch of If-Then statements saying "if [whatever code] appears in cell [XX] and the date is [whatever month], the counter will increment in the chart over to the right."

Anyway, if someone could give me an idea how to do this or tell me the Excel terms I need to know to do so, that would help.....

Excel SpreadSheet Question
I have a function that creates an excell spreed sheet with a snapshop of that database.

It works perfectly find on my computer, so i packaged and deployed it, it asked me if i wanted to package the excell.exe, so i said yes.
Now not, i have a different version then they do, i have Office XP, and they have Office 2000. Ok......
So i packaged up the excel.exe with it, put it on the network, and had someone install it, but it gave them some error about a file, so they continued with the setup.

They are able to run all functions, except, the button where you push to create the excel file..here i my code any ideas


VB Code:
Private Sub Command1_Click()Dim oConn As ADODB.Connection    Dim rst As ADODB.Recordset    Dim iCols  As Integer    Dim oApp As Excel.Application    Dim oWB As Excel.Workbook    Set oConn = New ADODB.Connection    oConn.ConnectionString = "Provider=SQLOLEDB.1;Server=MANIFEST2;Database=Northwind;UID=sa;PWD=;"    oConn.Open    Set rst = New ADODB.Recordset    rst.Open "SELECT * FROM JoeFox2;", oConn, adOpenKeyset, adLockOptimistic, adCmdText    Label17.Caption = "Creating Excel Spred Sheet..."    Set oApp = New Excel.Application    Set oWB = oApp.Workbooks.Add    For iCols = 0 To rst.Fields.Count - 1        oWB.Sheets(1).Cells(1, iCols + 1).Value = rst.Fields(iCols).Name    Next    Label17.Caption = "Processing Excel Spred Sheet....."    'bold the first rows header info    oWB.Sheets(1).Range(oWB.Sheets(1).Cells(1, 1), oWB.Sheets(1).Cells(1, rst.Fields.Count)).Font.Bold = True    'List all the oRs data...    oWB.Sheets(1).Range("A2").CopyFromRecordset rst    oWB.SaveAs "C:CellPhoneDatabase.xls"    oWB.Saved = True        ' Closing the instances so nothing is left in memory    oWB.Close    Set oWB = Nothing    oApp.Quit    Set oApp = Nothing    Label17.Caption = "Excel Spred sheet completed."

Excel Spreadsheet Manipulation
Hi Guys!

I will appreciate everybody’s input to help me solve this task.

Here is what I basically want to do:

I have an Excel Spreadsheet report with figures on it in the following format:


R000301546217
R0003360501
R000351629182019

What I basically need to do is

1.Read the excel file from a VB application
2.Do the format conversion to look like this

R0003015
R000304
R000306
R000302
R0003017

How do I read an excel spreadsheet from VB

Thanks,
Ryno

Excel Spreadsheet In VB, OLE Or Flexgrid?
Hello,

I have an Excel spreadsheet that is basically a crude map of houses/streets. Certain cells represent house numbers. There is a simple function that you enter a house number and the map (it's fairly large) finds it for you (thanks to excel's find function ) Rather cheesy, but it works...

Anyway, I was looking to add incorporate this sheet to VB to make it a little less busy and add some functionality. I did a search and found lots of different things that only confused me further.

What is the easiest way to get this form into VB while having it available to search for and edit cells (needs to always be 'open', so users don't have to click "edit")? OLE, Flexgrids...? Is there a way to convert an excel sheet to a flexgrid? Or should I just stick with good old Excel (booo)?

Any advice is appreciated, thanks

Pasting To An Excel Spreadsheet
I have a stand-alone VB program. I am copying a lot of data from a Microsoft Project 98 file. What I would like to do is Select Cell A17 on the Excel spreadsheet and paste the data.
The problem I am having is two fold.
1. Just before pasting the data, I put a value in A17, then paste. The paste arbitrarily starts in A1 wiping out all other data.
How do I get currancy on A17?
2. Is there a way of disabling the Excel message stating the the data to be copied is not the same size as the selection?

Thanks In Advance

Next Line In Excel Spreadsheet
How do i code it for a 'enter' key so that data is written on the next line of an excel cell? thank you .

Scan Excel Spreadsheet With VB
have an excel spreadsheet that I am using for a scheduler for my company. Well, it's built dynamically using a VB app and an Oracle database. All is well with building it but in the end, the owner of the company wants to have a worksheet built for each "workcenter" (We'll get into that in a second) and then "scan" the dynamically built spreadsheet for all rows where column "P" isn't blank and put copy them to the "Shear" worksheet and then do the same for "R" and put those rows into the "Punch" worksheet and so on. I have to do this for 14 columns. Is any of this making sense and can someone help me? Thanks, Jeremy

Opening Excel Spreadsheet In A VB App.
I am trying to get my VB app to show a specific Excel spreadsheet.

I have used the OLE control on my form to open the relevant spreadsheet, and I have a few questions.

I'm scouting around for help/tutorials as I have never used the OLE object before, but whilst I am doing that I thought I would throw a few questions out there to see if I get any feedback

OK here goes :

1. When running my app the spreadsheet only becomes "editable" when I right click it and select "Edit". Can I have it "editable" when my program starts ?

2. When in Edit mode on the spreadsheet I gather it dumps me in an Excel environment. This causes my screen to "bounce" as the Excel toolbars appear at the top of my screen, and subsequently disappear when I leave the spreadsheet. Is there any way to stop this ?

3. If the Excel OLE object is in "Edit" mode and I close my app I get an Excel application error. The only way round this is to leave the spreadsheet before closing my app. I triead an OLE.Close statement in my form Unload (which was a pure guess), and that didn't cure it ! Any ideas ?

Thanks in advance for any response

Values In Excel Spreadsheet!!
is it true that the values in excel spreadsheet can (ie the values in the cells is virtually stil lthere even if you have del. some rows to empty it...


eg..

when i open a spreadsheet....del the selected rows to make it empty.. close it ,windows prompt to save the file ..click yes..
then when i open the file again...just select more or less rows to del (again the form is already looks empty)....when close it...prompt again!!! to save the file!! wat happen?

Open An Excel Spreadsheet Within Vb App
i'm stuck trying to solve a problem of mine....

i am trying to open an excel document within a vb app that i am doing.

i have experimented on how to open a word document. but it opens into a new window and not within the application itself. worse still..... this line of code

doc.Application.Documents.Open pathname

causes many problems (which eventually resulted in my document being screwed)

anyone can give me a list of most commonly used methods available to all excel and word document handling in vb? i'm at a loss here........

thx

Printing Excel Spreadsheet
I'm attempting to print one or two sheets on an Excel Spreadsheet. I have a "Type Mismatch" when the line
"If Range("C9:J37") <> " " Then" is read. What I'm attempting
to query is "If the second sheet contains values in the range C9:J37 then, so that the sheet may be printed if there is values.
Would someone out there supply me with the correct string?


<vbcode>
'Select Sheet 2 for viewing.
Sheets("SheetTwo").Select
'If Sheet 2 contains inputed values.
If Range("C9:J37") <> " " Then
'Print Workbook.
ActiveWorkbook.PrintOut Copies:=1, Collate:=True
Else
Sheets("SheetOne").Select
'Print Selected Sheet [SheetOne].
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
End If
<vbcode>

Printing Excel Spreadsheet
I have an excel spreadsheet, that is generated by a program. I want to print that spreadsheet at the end of program run. I am unsure how to code the print commands. Below is an attempt to
perform this. This doesn't work. Please help

<vbcode>


Set XLS = CreateObject("Excel.Application")
'Above coded at begining of program

With XLS
.Worksheets("SheetOne").Activate
.Printer.ActiveSheet ' Send SheetOne.
.Printer.EndDoc ' Printing is finished.
End With

<vbcode>

Scanning An Excel Spreadsheet From A VB App
Hello

I need to scan some Excel spreadsheet automatically in search of a particular value in a cell.

How can I "open" an xls spreadsheet from my app?

i added the excel reference components and I'm reading a lot about Worksheet, Range and Cell objects, but I still haven't found how to open and reference an .xls file

From then on I guess is just a case of nested cycling through the various collections down to the single cell until I find what I'm looking for, am I right?

Can somebody help me?

Thx

Printing An Excel Spreadsheet From VB
I tried the following and an error message appears that the ActiveWindow property or method does not exist.
Code:
Set xlSheetData = xlBook.Worksheets("report")
xlSheetData.ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
What I want to do is print the contents of a specific worksheet. Did a search and found the second line of code (I added the first because I wasn't sure VB knew what sheet to work from). Any suggestions?

Thanks

Unhiding An Excel Spreadsheet
I am updating an Excel Spreadsheet with VB6. After all action is taken I save and close the Spreadsheet with the following code:

xl2.Application.Workbooks(2).Worksheets("schedule start").Activate
xl2.Application.WindowState = xlMaximized 'xlMinimized
xl2.Application.Workbooks(2).Save
Close

The problem is, the program Hides the spreadsheet. How do I Unhide the spreadsheet? With multiple users, the name of the spreadsheet will never be the same.

Any Ideas?
Thanks in advance.

Excel Spreadsheet On Form.
I have placed a excel sheet on my form by going into Components, Insertable Objects tab, and then selecting MS Excel Worksheet.

Does anybody know how I can edit the contents of each cell in the Excel sheet on my form. I do not want VB to open up excel, and show the form in Excel, I would like it to display everything on the form. I cannot figure out how to edit the cells, or load a .xls file into the object. If an example is needed, I will glady post one, or if someone needs clarification, I will try my best to clarify. Thanks.

Output In An Excel Spreadsheet?
I'd like to be able to output the content of the labels in my vb program to specific cells in an excel spreadsheet. Can I do so? How?

Thanks

Output - Excel Spreadsheet
When I save the contents of a listbox or whatever to a .xls and it will open Excel and everything will be okay. But does anyone know how I can adjust column height and width, and put data into certain cells?

Thanks,
Paul

Printing Excel Spreadsheet
My program uses a MS Excel 97 spreadhsheet to print data. Some of the computers that use the program may not have MS Excel installed on them which is causing errors in my program. Is there a way to print an Excel spreadsheet on a computer that doesn't have MS Excel installed.

Thanks!

Copyright 2005-08 www.BigResource.com, All rights reserved