•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the Visual Basic 4 / 5 / 6 section within the Software Development category of DaniWeb, a massive community of 391,548 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,543 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Visual Basic 4 / 5 / 6 advertiser:
Views: 3030 | Replies: 1
![]() |
•
•
Join Date: Jun 2006
Posts: 29
Reputation:
Rep Power: 3
Solved Threads: 0
greetings
i am doing a database system in access and has certain function of creating and modifying an excel worksheet. i keep getting this "Run-time error '462' : Remote server machine doesn't exist or is unavailable" or sometimes "Run-time error '1004' : Method 'Range' of object '_Global' failed"..
it points to this line
when i click on one of my command button
as well as
in a different command button.
here's the code for the function that is called when some1 clicks the command button
OpenExcel function has the declarations for xlApp etc2..
the pointed error "Range(checker1).Select" exists in the functions "WaferSortAddProduct" and "AssemblyAddProduct", which i stored in a module, which btw, this function also exists in the same module... i use the range and select thing to modify the property of the cells, some merging, fonts, formula, borders and default values. i copy and modify it from excel recorded macros.
weird thing is, it works on the first run, then on the second run it gives the run time error, which then it works again on the third run and fails on the fourth run.. it goes on and on in that sequence..
also i can't seem to end the excel process.. i tried using all the codes that i could get my hands on but none of them actually ends the process.. after each try i have to manually end the process in task manager..
i'm getting really frustrated over this part.. i'd really appreciate any form of help/feedback.. thanks in advance
-osman-
i am doing a database system in access and has certain function of creating and modifying an excel worksheet. i keep getting this "Run-time error '462' : Remote server machine doesn't exist or is unavailable" or sometimes "Run-time error '1004' : Method 'Range' of object '_Global' failed"..
it points to this line
Range(checker1).Select
as well as
ActiveWorkbook.Close True
here's the code for the function that is called when some1 clicks the command button
Dim checker(5) As String
Dim insertion As Integer
OpenExcel
Set xlApp = CreateObject("Excel.Application")
Set xlBook = xlApp.Workbooks.Open("C:\Osman\ABP-FET Reference.xls")
insertion = 0
Do
MsgBox (insertion) 'i added this for trial runs only, to check if it
' follows the correct sequence
Set xlSht = xlBook.Worksheets("Wafer Sort")
Set xlRng = xlSht.Cells((insertion * 4) + 7, 3)
checker(1) = xlRng.Value
Set xlRng = xlSht.Cells((insertion * 4) + 7, 4)
checker(2) = xlRng.Value
Set xlSht = xlBook.Worksheets("Assembly")
Set xlRng = xlSht.Cells((insertion * 4) + 7, 3)
checker(3) = xlRng.Value
Set xlRng = xlSht.Cells((insertion * 4) + 7, 4)
checker(4) = xlRng.Value
insertion = insertion + 1
Loop Until checker(1) = "" And checker(2) = "" And checker(3) = "" And checker(4) = "" ' checking for empty cells
insertion = ((insertion - 1) * 4) + 7
MsgBox (insertion) 'trial run purposes, to check on which row product
'will be added
DC = InputBox("Please insert D/C", "Add")
PN = InputBox("Please insert P/N", "Add")
Set xlSht = xlBook.Worksheets("Wafer Sort")
xlSht.Activate
dummy = WaferSortAddProduct(insertion, DC, PN)
Set xlSht = xlBook.Worksheets("Assembly")
xlSht.Activate
dummy = AssemblyAddProduct(insertion, DC, PN)
xlApp.Application.UserControl = True
xlApp.Application.Visible = True
ActiveWorkbook.Close True
xlApp.Application.Visible = False
xlApp.Quit
Set xlRng = Nothing
Set xlSht = Nothing
Set xlBook = Nothing
Set xlApp = NothingOpenExcel function has the declarations for xlApp etc2..
the pointed error "Range(checker1).Select" exists in the functions "WaferSortAddProduct" and "AssemblyAddProduct", which i stored in a module, which btw, this function also exists in the same module... i use the range and select thing to modify the property of the cells, some merging, fonts, formula, borders and default values. i copy and modify it from excel recorded macros.
weird thing is, it works on the first run, then on the second run it gives the run time error, which then it works again on the third run and fails on the fourth run.. it goes on and on in that sequence..
also i can't seem to end the excel process.. i tried using all the codes that i could get my hands on but none of them actually ends the process.. after each try i have to manually end the process in task manager..
xlApp.Quit Set xlRng = Nothing Set xlSht = Nothing Set xlBook = Nothing Set xlApp = Nothing
i'm getting really frustrated over this part.. i'd really appreciate any form of help/feedback.. thanks in advance
-osman-
Last edited by BombAppetit : Jul 4th, 2006 at 10:45 pm.
•
•
Join Date: Dec 2004
Location: Lincoln Park, Michigan
Posts: 1,744
Reputation:
Rep Power: 7
Solved Threads: 107
Hmn, I don't seem to get that error when I run your code on my box... I wasn't sure how your ABP-FET Reference.xls file looks, so I kind of guessed, and maybe that's the issue (probably, if it's a problem with a text range), but umn..... it seems to work for me....maybe you could attach both the .xls file and the .vbs file in a .zip file.
![]() |
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
•
•
•
•
DaniWeb Visual Basic 4 / 5 / 6 Marketplace
Similar Threads
- Writing to an Access Database (Visual Basic 4 / 5 / 6)
- VB: Connect to Access database via ODBC datasource name (Visual Basic 4 / 5 / 6)
- Date fields imported from access file to excel spreadsheet is converting to number (Visual Basic 4 / 5 / 6)
- Using VBA with Access (was: Please Help!!!) (Visual Basic 4 / 5 / 6)
- How to read from serial port into excel (Visual Basic 4 / 5 / 6)
- Good Luck w/This one: Excel Question VBA/Macro/other (MS Access and FileMaker Pro)
Other Threads in the Visual Basic 4 / 5 / 6 Forum
- Previous Thread: Change icon of an Exe file created in VB
- Next Thread: Sound manuplating in vb 6



Linear Mode