Click here to Skip to main content
15,921,452 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: How to change dataset connection string at run time Pin
shiroamachi8-Jan-06 15:20
shiroamachi8-Jan-06 15:20 
GeneralRe: How to change dataset connection string at run time Pin
Colin Angus Mackay8-Jan-06 20:28
Colin Angus Mackay8-Jan-06 20:28 
QuestionHow to add the runtime shortcut keys in application Pin
Laxman95-Jan-06 18:04
Laxman95-Jan-06 18:04 
AnswerRe: How to add the runtime shortcut keys in application Pin
Laxman95-Jan-06 18:06
Laxman95-Jan-06 18:06 
Questionhow I can Add my Link As button in ie toolbar ? Pin
Sa1565-Jan-06 16:19
Sa1565-Jan-06 16:19 
AnswerRe: how I can Add my Link As button in ie toolbar ? Pin
ramani.r5-Jan-06 18:12
ramani.r5-Jan-06 18:12 
GeneralRe: how I can Add my Link As button in ie toolbar ? Pin
Sa15610-Jan-06 23:36
Sa15610-Jan-06 23:36 
QuestionVB-6 / Excel interaction Pin
Garner T5-Jan-06 15:02
Garner T5-Jan-06 15:02 
Hi all,
I am new to this forum so please bear with me until I learn how things are done here.
I am trying to write a “VB-6” program where the user can click on a picture of a part and the program then opens an “Excel” price list for them. I used a transparent text box over the picture. You can start the program, click the picture, and an “Excel” window opens with the proper line highlighted. Then, if you close the “Excel” window and try to click on the picture again, the program balks. Part of the “Excel” window appears but it is empty. The program doesn’t crash. It just refuses to show the “Excel” sheet again.

This is the code that I used:
Dim AppExcel As Excel.Application

This sub sets the focus on the picture so the scroll bar doesn’t blink.
Private Sub Form_Activate()
p4l80e.SetFocus
End Sub
This sub tells the program to open “Excel”.
Private Sub Form_Load()
Set AppExcel = CreateObject("Excel.Application")
Workbooks.Open FileName:="D:\K and D (152598).xls"
End Sub
This sub makes “Excel” visible, finds the proper row, and highlights the entire row.
Private Sub lbl034_Click()
'On Error GoTo erh

AppExcel.Visible = True

Cells.Find(What:="34034b", After:=ActiveCell, LookIn:=xlFormulas, LookAt _
:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _
False, SearchFormat:=False).Activate
'Highlights the entire row.
If IsEmpty(ActiveCell) Then Exit Sub
On Error Resume Next
If IsEmpty(ActiveCell.Offset(0, -1)) Then Set LeftCell = ActiveCell Else Set LeftCell = ActiveCell.End(xlToLeft)
If IsEmpty(ActiveCell.Offset(0, 1)) Then Set RightCell = ActiveCell Else Set RightCell = ActiveCell.End(xlToRight)
Range(LeftCell, RightCell).Select
Exit Sub
erh: MsgBox Error(Err)
End Sub
This is a different attempt at the above code with a different part number. It will work the first time around also. Second attempt, it also will not respond.
Private Sub lbl070_Click()
On Error GoTo erh

'Set AppExcel = CreateObject("Excel.Application")
Workbooks.Open FileName:="D:\K and D (152598).xls"
Cells.Find(What:="34070e", After:=ActiveCell, LookIn:=xlFormulas, LookAt _
:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _
False, SearchFormat:=False).Activate
AppExcel.Visible = True
Exit Sub
erh: MsgBox Error(Err)
End Sub
The following code works fine. It just controls the scroll bar to move the picture of the parts to be selected.
Private Sub scr_Change()
On Error GoTo erh
p4l80e.Top = scr.Value
' p24L80E.Top = scr.Value + 12500
erh:
End Sub

Private Sub scr_Scroll()
Call scr_Change
p4l80e.SetFocus
End Sub
I am FAR from a pro. at this. I just taught myself from books that I bought so I might not understand a reply unless it’s kept pretty simple and straight forward.
Thanks in advance, Garner


hi,

just close the workbook and also quit the excel application before exiting the Sub routine.



Paritosh

Hi again & thanks to Paritosh,
I thought that this was the problem but I haven't figured out how to fix it. If I use a "close" event in the sub that shows the "Excel" workbook, the workbook flashes on the screen and back off before you get to look at it. I tried to put it in my main form "activate" sub and that didn't work either. I need this to happen automatically as the user closes the "Excel" window so they can just click on another part of the picture.
Could you give me an idea of what the code would look like and what sub to put it in? Like I said, I'm "self-taught" in "VB" so my teacher isn't the sharpest tool in the shed.
Thanks again, Garner

QuestionIIS scripting with VB.NET ?? Pin
Dammark5-Jan-06 10:44
Dammark5-Jan-06 10:44 
AnswerRe: IIS scripting with VB.NET ?? Pin
Dave Kreskowiak5-Jan-06 18:29
mveDave Kreskowiak5-Jan-06 18:29 
AnswerRe: IIS scripting with VB.NET ?? Pin
Dave Kreskowiak5-Jan-06 19:11
mveDave Kreskowiak5-Jan-06 19:11 
QuestionVB.NET Implementation of Bittorrent Pin
Member 21312795-Jan-06 10:03
Member 21312795-Jan-06 10:03 
AnswerRe: VB.NET Implementation of Bittorrent Pin
Christian Graus5-Jan-06 10:26
protectorChristian Graus5-Jan-06 10:26 
GeneralRe: VB.NET Implementation of Bittorrent Pin
Colin Angus Mackay5-Jan-06 13:36
Colin Angus Mackay5-Jan-06 13:36 
GeneralRe: VB.NET Implementation of Bittorrent Pin
Christian Graus5-Jan-06 13:37
protectorChristian Graus5-Jan-06 13:37 
GeneralRe: VB.NET Implementation of Bittorrent Pin
Dave Kreskowiak5-Jan-06 18:23
mveDave Kreskowiak5-Jan-06 18:23 
GeneralRe: VB.NET Implementation of Bittorrent Pin
Member 213127912-Feb-06 0:06
Member 213127912-Feb-06 0:06 
GeneralRe: VB.NET Implementation of Bittorrent Pin
Dave Kreskowiak12-Feb-06 2:10
mveDave Kreskowiak12-Feb-06 2:10 
QuestionWin App in Vb.net- shutsdown suddenly, help! Pin
kanchv5-Jan-06 8:18
kanchv5-Jan-06 8:18 
AnswerRe: Win App in Vb.net- shutsdown suddenly, help! Pin
Jared Parsons5-Jan-06 8:33
Jared Parsons5-Jan-06 8:33 
GeneralRe: Win App in Vb.net- shutsdown suddenly, help! Pin
kanchv9-Jan-06 4:53
kanchv9-Jan-06 4:53 
Questionsaving multiple audio channels with Encoder Pin
dwalters5-Jan-06 7:57
dwalters5-Jan-06 7:57 
QuestionAccessing control in other application Pin
pjadams2255-Jan-06 7:38
pjadams2255-Jan-06 7:38 
AnswerRe: Accessing control in other application Pin
Dave Kreskowiak5-Jan-06 8:06
mveDave Kreskowiak5-Jan-06 8:06 
QuestionCrystal Reports - Reset Page Number Pin
dptalt5-Jan-06 5:14
dptalt5-Jan-06 5:14 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.