|
-
Jul 25th, 2005, 04:32 PM
#1
Thread Starter
New Member
VBA/Notepad - Please Help
Hello all,
I'm new to the forum and pretty new to programming too. I'm trying to work on a problem that is pretty difficult for me. Hope one of you guys can help me.
Here's what I'm trying to do - I have a list of words in an excel sheet. I'd like to open an existing text file and compare the list of words (in excel) with the words in the notepad file and prompt if there is a word that does not match with any word in the list. I know how to open a notepad file and other basic stuff. any help will be appreciated. Thanks!
P.S- I searched the forums. I could not find anything similar. Sorry if the issue has been addressed!
-
Jul 25th, 2005, 05:02 PM
#2
Re: VBA/Notepad - Please Help
Welcome to the Forums.
You can open an Excel workbook by using code like so...
VB Code:
Option Explicit
'Add a reference to ms excel xx.0 object library
Private moApp as excel.application
private sub form_load()
set moapp = new excel.application
end sub
private sub command1_click()
dim oWB as excel.workbook
set owb = moapp.workbooks.open("C:\Test.xls")
if owb.sheets(1).cells(1, 1).value = strFirstMatchVar then ' assuming that this is your read in textfile value: strFirstMatchVar
'do nothing since found
else
msgbox "not found"
endif
owb.close true
set owb = nothing
end sub
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
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
|