Solved

Access To Excel Form

Posted on 2014-04-20
12
513 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
  • 7
  • 5
12 Comments
 
LVL 33

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 33

Expert Comment

by:Norie
ID: 40011885
How are you opening the Excel workbook?
0
 

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 33

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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 

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 33

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 33

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

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

PaperPort has a feature called the "Send To Bar". It provides a convenient, drag-and-drop interface for using other installed software, such as Microsoft Office. However, this article shows that the latest Office 2016 apps (installed with an Office …
A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
Learn how to make your own table of contents in Microsoft Word using paragraph styles and the automatic table of contents tool. We'll be using the paragraph styles in Word’s Home toolbar to help you create a table of contents. Type out your initial …
Learn how to create and modify your own paragraph styles in Microsoft Word. This can be helpful when wanting to make consistently referenced styles throughout a document or template.

757 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now