Mac VBA code to select a form option button - excel

I can writing VBA in Mac os. The below code in excel (windows) check an option button.
ActiveSheet.Shapes("Otion button 1").OLEFormat.Object.Value=true
This code does not work in Mac excel.
Can anyone help to get the code for Mac excel to do this function.
Thank you,

The code you pasted doesn't work in the Windows environment either. It results in an error: "Runtime error '438': Object doesn't support this property or method"
After exploring the locals window, I found that the correct way to access this value is through a double .object ... So your code would be:
ActiveSheet.Shapes("Otion button 1").OLEFormat.Object.Object.Value = True

Related

Runtime error 7 while using Selenium with VBA for data entry into an online system

I am new in VBA and Selenium. Wrote some lines using Selenium ChromeDriver that can open a online data management system, and log in successfully. I need to manually click on a map, and a table pops up where I need to input some data from a excel sheet using VBA. On that online page, I can access all the components using various methods (e.g., FindElementByName, FindElementByXPath, etc.) **except **the edit boxes and the dropdown elements on the popup table. I even can access the buttons on the bottom of the table. Only when I try to access the elements on the table, it give me the RUN TIME ERROR 7 OUT OF MEMORY. I have attached an image but hid some elements due to the confidential nature of the work. I know it is not a lot of information, but if someone can give me some directions I will highly appreciate it.
Thanks
I am using Selenium Chrome Driver
'Other Subs are here....
Sub Entry()
'I am using these methods to test
myChrome.FindElementByXPath("//div[#class='ui-jqgrid-bdiv']//input[#name='input_ROUTE']").Value = "500"
myChrome.FindElementByName("input_ROUTE").SendKeys "500"
'These throws the Run-time error 7, Out of memory
'However, the same methods works for everything else except the elements on that table
End Sub`
Check the HTML, it is possible that input_ROUTE is inside an iframe element, and the XPath you get is internal inside the iframe.
If this is the case, you need to first move into the iframe and then turn to the internal component. so:
myChrome.SwitchToFrame myChrome.FindElementByXPath("//*[#id=""loginIframe""]") 'Of course you need to change the XPath
myChrome.FindElementByName("input_ROUTE").SendKeys "500"

Excel Open in Protected View and Can't Run VBA

I use the Private Sub Workbook_Open() for some VBA code in order to run those code when I open the workbook. I try it on my laptop, it works fine but when I send the file to my colleague the file, it opens in protected view, and then when clicking the enable editing, it got Error code 1004: Method ‘Sheets’ of Object ‘_Global’ Failed. Try to surf the internet, it said that because the file opens on protected view so the VBA won't run.
How can I solve this problem?
Thank you

Userform won´t load after "software" update

I made a VBA Project with 2 userforms in a verison of Office 365. But after an recent update (new computer with new installation of Office) the userforms cant be loaded. I have not been able to spot the diffrence between the Excel versions as all the versionnumbers match eachother.
I thought it was a problem with the datepicker control but error presistes even after that control is removed. I have also verified that Excel is of 32 bit verison on both computers
Option Explicit
Public Sub Menu() <-Shortcut runs this
UserForm2.Show
End Sub
Private Sub UserForm_Initialize() <-Userform2 Initializes
Set UF = New UserForm1 <- Error
Do stuff in UserForm2
End Sub
When the datepicker control was in the UserForm1 the error recived was:
Could not read some objects since they are´nt availible on this computer
Followed by
Complie error in hidden modul UserForm1.
Error usally shows when the code is incomapitble
with the app version, platform or architecture.
These are the reference for the Project:
VBA
Excel 16 Obj. Lib.
OLE Automation
Office 16 Obj. Lib.
Forms 2 Obj. Lib.
Common Controls-2 6.0 (SP6)
My knowledges limt has been reached as I thought that this is was 64 bit issue. If I remove the datepicker control from UserForm1 it only shows the second error.
If you google for it you will find e.g. this:
Download the MSCOMCTL.ocx in Microsoft Download.
On search menu / Cortana search command prompt and run it as administrator by right clicking it.
Copy the MSCOMCTL.ocx file to C:\Windows\SysWOW64.
Navigate the command prompt to the location C:\Windows\SysWOW64 and type regsvr32 mscomctl.ocx.
Do regsvr32 both mscomctl.ocx and mscomct2.ocx

Excel Loading PDF in Userform

So I have been able to load a PDF into my userform (Excel 2013 on all machines) setting reference Adobe Acrobat Webrowser Control and adding control to userform. When i open the file on another computer or try to create another excel userform and pdf I get the following errors "Run-time error-459" or "Element not found" or "Compile error: Method or data member not found"
I am using Acrobat Adobe Reader DC
I also noticed when adding control to form it labels it as Control1 instead of AcroPDF1
Private Sub Workbook_Open()
With UserForm1.Control1
.LoadFile ThisWorkbook.Path & "\sample.pdf"
End With
UserForm1.Show
End Sub
Please any help much appreciated
Make sure that the Additional Control for Adobe has been added. Also take a quick look into this post for workaround and suggestions. http://www.ozgrid.com/forum/showthread.php?t=88177
After some trial and error i found a solution. I was currently using google chrome when experiencing this issue. The problem was that i had a google app conflicting with the pdf. So i disabled google apps and problem dissappeared. Sorry comunity i didnt resopnd earlier..thanks for all the input

if statement to see if a Form checkbox is checked from a regular module

I need to check if Userform Checkbox is checked but my code is in a regular module not userform. Please suggest how to do this correctly? Or does this only works from a userform module?
if Userform1.Checkbox1 = True 'checkbox is checked //compile error observed
Thank you

Resources