Solved

Access To Excel Form

Posted on 2014-04-20
12
523 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
Office 365 Training for Admins - 7 Day Trial

Learn how to provision tenants, synchronize on-premise Active Directory, implement Single Sign-On, customize Office deployment, and protect your organization with eDiscovery and DLP policies.  Only from Platform Scholar.

 

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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Traditionally, the method to display pictures in Access forms and reports is to first download them from URLs to a folder, record the path in a table and then let the form or report pull the pictures from that folder. But why not let Windows retr…
This article describes how you can use Custom Document Properties to store settings and other information in your workbook so that they will be available the next time you open the workbook.
This Micro Tutorial demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.
This Micro Tutorial will demonstrate on a Mac how to change the sort order for chart legend values and decrpyt the intimidating chart menu.

688 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