ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   VB Script in Ecell (https://www.excelbanter.com/excel-worksheet-functions/49964-vbulletin-script-ecell.html)

Dennis Evans

VB Script in Ecell
 
Hi

I have 2 basic questions

1. I have an Excel file with a Form I created in VB. How do I get this from
to load automatically when the Speadsheet is open.

2. A VBscript that will open the above Form in Excel and bring it to the
forground from a 3rd part application

Cheers

--
Cheers

Dennis Evans



Bob Phillips


"Dennis Evans" <Dennis wrote in message
...
Hi

I have 2 basic questions

1. I have an Excel file with a Form I created in VB. How do I get this

from
to load automatically when the Speadsheet is open.


Private Sub Workbook_Open()
Userform1.Show
End Sub

'This is workbook event code.
'To input this code, right click on the Excel icon on the worksheet
'(or next to the File menu if you maximise your workbooks),
'select View Code from the menu, and paste the code

2. A VBscript that will open the above Form in Excel and bring it to the
forground from a 3rd part application


You need automation for this. Something along the lines of

Dim xlWb As Object
Dim sFile As String

sFile = "C:\Documents And Settings\Bob\Desktop\Area Codes.xls"
Set xlWb = GetObject(sFile)
'do more stuff
xlWb.Close
Set xlWb = Nothing

which assumes that Excel is already running, and that you have the previous
userform display code in that workbook.






All times are GMT +1. The time now is 12:11 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com