-
January 22nd, 2013, 03:42 PM
#1
visual basic express read/write to excel question
i have downloaded vbe 2010 and thats where im pretty much stuck . i do logic programing this type of code is killing me . is their an easier way . this is what i got , an excel spreadsheet runs my project .all i need is access to cell B1 to input a text string , and access to cell E1 so i can see what my value is , thats it , two little windows on a vbe screen . i just dont like the look of the spreadsheet when i convert to an exe. so i figured vbe screen would cover it up . am i wrong as hell or what
thanks
-
January 23rd, 2013, 01:10 AM
#2
Re: visual basic express read/write to excel question
-
January 23rd, 2013, 11:56 PM
#3
Re: visual basic express read/write to excel question
Export to TEXT, and then read the file. Problem solved!
-
January 24th, 2013, 02:20 PM
#4
Re: visual basic express read/write to excel question
this is a voice control program . i just need it to look neat . i talk into cell B1 , my spreadsheet runs a calc. then my value seen in cell E1 . ive looked all over the web and cant find code that doesnt include a button . i need full time access to cell B1 and a full time view of cell E1 because the software will run 24-7 .is their another option to convert my spreadsheet to a stand alone program without looking like a spreadsheet ?
-
January 24th, 2013, 03:04 PM
#5
Re: visual basic express read/write to excel question
Does it really need to be a spreadsheet, does it even need to use Excel?
Always use [code][/code] tags when posting code.
-
January 24th, 2013, 03:29 PM
#6
Re: visual basic express read/write to excel question
eventually it will be all code , a stand alone program . i have perfected voice control that can apply to anything . i am meeting with prosthetic companies next week hopefully to apply it to a bionic hand . ill be making videos of some applications this weekend . do you have other suggestions for hiding the sheet for now .
-
January 24th, 2013, 11:41 PM
#7
Re: visual basic express read/write to excel question
Not really, I don't know enough about what you are doing and Excel would be so far down my list of options that it would not be considered. Typically I would use a database or a flat file depending on what I need and then write code to handle any calculations and display needed but then I have no idea what this spreadsheet looks like nor what data is in it or what kinds of calculations it may be doing.
If you don't want to see the sheet but need the data from it then I would consider exporting the data to a TAB delimited or CSV file and then use the data in the program and eliminate Excel from the equation.
Always use [code][/code] tags when posting code.
-
January 29th, 2013, 10:10 AM
#8
Re: visual basic express read/write to excel question
I'm guessin david was breast fed by daddy. Is there a way I can get a private message to datamiser ?
-
January 29th, 2013, 10:33 AM
#9
Re: visual basic express read/write to excel question
I prefer to keep questions and answers in the forums so others may be helped. Also there are others here who may be able to add to the topic and help you in the process.
Always use [code][/code] tags when posting code.
-
January 29th, 2013, 10:46 AM
#10
Re: visual basic express read/write to excel question
Ok can you do a visual basic app that has one text box that writes to cell B1 and a window that looks at cell E1 ?
-
January 29th, 2013, 10:58 AM
#11
Re: visual basic express read/write to excel question
I do not use Excel in my apps, I really hate working with it.
Like I said before unless there is some specific reason to use Excel then I would not use it. I would export the data to a different format and work with the data.
Always use [code][/code] tags when posting code.
-
January 30th, 2013, 09:23 AM
#12
Re: visual basic express read/write to excel question
Here are some chunks of stuff I've used before:
Code:
Dim oExcel, oBook, oSheet As Object
oExcel = CreateObject("Excel.Application")
oBook = oExcel.workbooks.add
oSheet = oBook.worksheets(1) ' the sheets are 1 based - not zero
oSheet.cells(1,1).value = "Hello World" ' the cells are 1 based - not zero
msgbox(oSheet.cells(1,1).value)
oBook.saveas("Tester")
oBook.close()
oExcel.quit()
oSheet = Nothing
oBook = Nothing
oExcel = Nothing
probably want to try an "open" on the workbook or worksheet object then a loop to monitor the cell in question.
-
February 3rd, 2013, 07:39 PM
#13
Re: visual basic express read/write to excel question
It's pretty simple with the Microsoft Office Interop namespaces... http://msdn.microsoft.com/en-US/libr...=vs.80%29.aspx
Why are you using Excel though? Just to see if you can input the data to a spreadsheet? :S The calculation part of it can be done with functions in Excel directly.
If you don't want to do it the COM way, then you could attempt uncompressing the archive (compressed with the DEFLATE/Base64 method like most zip archives) to reveal all of the XML files that are used for the spreadsheet, and edit those.
Last edited by AceInfinity; February 3rd, 2013 at 07:43 PM.
[sigpic][/sigpic]
Microsoft MVP .NET Programming (2012 - Present)
®Crestron DMC-T Certified Automation Programmer
-
February 24th, 2013, 09:35 PM
#14
Re: visual basic express read/write to excel question
Write Excel:
Code:
sheet.Range("B1").Text = "XYZ"
Read Excel:
Code:
sheet.Range("E1").Value
I use a VB.NET Excel component.
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
|