Solved

Access To Excel Form

Posted on 2014-04-20
12
522 Views
Last Modified: 2014-04-22
Hello All,

I think this may be a tough nut to crack but ....i want to open an excel file via access VBA. Now the access vba should be able to access userform2 of that excel workbook and fill one of the textbox.

Is that possible?
VBC or something?

Thank you
0
Comment
Question by:Rayne
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 7
  • 5
12 Comments
 
LVL 34

Expert Comment

by:Norie
ID: 40011877
I think it might be possible but I have to ask why you want/need to access the Excel userform to fill in a textbox?

What does filling in the textbox do?

Also, in the Access VBA you currently have are you automating Excel?
0
 

Author Comment

by:Rayne
ID: 40011883
ok, so there is a excel workbook that is pass protected.so when users open the workbook, the workbook shows up a userform that requires a pass value. once the user enter in the pass value and hit ok, the workbook filters the data as per the login privilege and then show up the info in sheet1.

That's the excel piece.

For the access  - i have all the data tables stores in he access. And have a custom "refresh" vba button. When  press it, it basically copies the records set from the access table and then  puts in sheet2 on workbook.

now the problem - when the (access) VBA refresh happens, the userform shows up (as it is in the workbook on open event on the worokbook)

so how do i do the access refresh from access vba and not have to worry about facing this pass form...
0
 
LVL 34

Expert Comment

by:Norie
ID: 40011885
How are you opening the Excel workbook?
0
Create Professional Looking Email Signatures

Create "Professional HTML Email Signatures" with ease.
7 Day Money Back Guarantee if not 100% Satisfied.
Affordable - Try it out for 7 Days Totally Risk Free.
Installers provided for over 45 Email clients.
Both Windows & MAC Supported.
Highly Recommended!

 

Author Comment

by:Rayne
ID: 40011890
Thank you,

Like this

    Set objXL = New excel.Application
   ' objXL.Visible = True
 
   
    Set wkb = objXL.Workbooks.Open("\fg\wk.xlsm")
0
 
LVL 34

Accepted Solution

by:
Norie earned 500 total points
ID: 40011899
If you want to bypass the userform when the workbook opens you could disable events in Excel.
objXL.EnableEvents = False

Open in new window

However I'm not sure that's what you want to do.
0
 

Author Comment

by:Rayne
ID: 40011954
Hello Imnorie,

that works like GOLD,

thank you thank you :)
0
 

Author Comment

by:Rayne
ID: 40011957
Imnorie,

once i do this
objXL.EnableEvents = False

all work....BTW - i am calling a workbook macro from access vba too, at the end. That will work even in this setting?


Thank you
0
 
LVL 34

Expert Comment

by:Norie
ID: 40013565
Disabling events should only affect code that's triggered by an event, for example the Workbook_Open event.

There should be no problem with any other code.

How are you calling the 'workbook' macro?
0
 

Author Comment

by:Rayne
ID: 40013599
thank imnorie,

I am doing this
objXL.run myMacro
0
 
LVL 34

Expert Comment

by:Norie
ID: 40013628
Is 'myMacro' the name of the macro?
0
 

Author Comment

by:Rayne
ID: 40013920
yes imnorie
0
 

Author Closing Comment

by:Rayne
ID: 40014682
Hello Imnorie,

i apologize, i totally forgot you gave me the solution :( already
0

Featured Post

Enroll in May's Course of the Month

May’s Course of the Month is now available! Experts Exchange’s Premium Members and Team Accounts have access to a complimentary course each month as part of their membership—an extra way to increase training and boost professional development.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

In earlier versions of Windows (XP and before), you could drag a database to the taskbar, where it would appear as a taskbar icon to open that database.  This article shows how to recreate this functionality in Windows 7 through 10.
In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
This Micro Tutorial demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.
This Micro Tutorial will demonstrate how to create pivot charts out of a data set. I also added a drop-down menu which allows to choose from different categories in the data set and the chart will automatically update.

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question