|
When I run the macro, a small window pops up that says "Compile error: Invalid or unqualified reference". When I click "OK" the code comes up and ".LineNumbering.Active =" is highlighted. If I delete the entire ".LineNumbering.Active = False" line and try again, I get the same compiler error message and now ".TopMargin =" is highlighted.
I am no expert on VBA by any stretch of the imagination, but it seems to me that the reference "ActiveDocument.PageSetup.anything" is invalid. As soon as the complier tries to reference ActiveDocument.PageSetup.whatever, it spits out the Compile error.
Since exactly this code worked fine in Word for Mac 2011, was there some change in reference syntax in Word for Mac 2016 that I don't know about? I also found it curious that I could record certain keystrokes with "Record Macro" in Word for Mac 2016 but not certain drop-down menu commands. I hope that this is not a bug in Word for Mac 2016.
Thanks for your patience.
|
|
|
|
|
I just noticed the following in your code snippet:
Sub Macro1()
.LineNumbering.Active = False
The first line of your macro is commented out, so you do not have a reference for all the following lines.
|
|
|
|
|
I uncommented and ran and got a different error: "Run-time error '424': Object required". I clicked Debug and the first line was highlighted "With WordApp.ActiveDocument.PageSetup"
|
|
|
|
|
Sorry, but I do not have a Mac system so there is no way I can test this for you. I can only suggest that for some reason the macro is not getting hold of the PageSetup object.
|
|
|
|
|
Thank you for helping. My impression is that Microsoft deprecated the ability to encode drop-down menu commands into user-recorded macros in Word for Mac 2016. This would explain my inability to record page margin changes into a macro in the 2016 version and would also explain why my 2011 macro code is not getting hold of the PageSetup object in the 2016 version. Word for Mac 2016 does include a new drop-down menu option that achieves nearly the same margin adjustments, so I'll just use that one for now. You assistance is much appreciated.
|
|
|
|
|
Dear Sirs,
I got a UserControl called "Card"; on a page I will have up to a hundred Cards, named as Card0, Card1, etc. and I cannot access their properties or controls because Findcontrol does not work for Usercontrol.
BTW, here is my code:
Dim one_card as UserControl = FindControl("Card0")
Dim one_card as Card = FindControl("Card0")
Dim one_card as Control = FindControl("Card0")
I also tried Page.Findcontrol.
What am I doing wrong? Are there any workarounds? Thanks.
|
|
|
|
|
Can you share the markup for one of these controls?
|
|
|
|
|
<%@ Register Scr="~ascx/card.ascx" TagPrefix="uc1" TagName="Card" %>
<uc1:card id="Card0" runat="server iCode_str="pg" />
iCode_str is property and Visual Studio perfectly sees it!!
If I use
Dim One_Card as Card= FindControl("Card0")
str_a=One_card.iCode_st
The last line is not underlined by Visual Studio as an error. Also, it shows the property in a dropdown box. It means, all set well, but I just cannot understand why Findcontrol does not work...
|
|
|
|
|
Is it in a master page? Are you using ContentPlaceHolder?
|
|
|
|
|
Not master page. Can you recreate something on your computer, will it work? It seems to me that all those questions are just to give you points. Sorry.
|
|
|
|
|
Points don't buy anything. We're really just idiots in our spare time trying to help.
To recreate conditions on your machine, I will need your machine
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
So, does Findcontrol work for Usercontrol on you machine?
|
|
|
|
|
For my user controls on "my machine" (er...asp.net...) yes. The questions I've asked are an attempt to drag sufficient information out of you so that someone can actually help. "Points"...it's not like I can convert those 2 rep points into cash!
|
|
|
|
|
Can I have a sample of the code please where Findcontrol does work for Usercontrol. Thanks.
==================
My further investigation showed that Findcontrol does not work for Usercontrol placed on a page which has a masterpage. Is it a bug?
modified 25-Jun-16 1:06am.
|
|
|
|
|
The only possible workaround for me at this stage is not to use masterpages.
|
|
|
|
|
As I can't tell clearly here where you are trying to call FindControl from, I would suggest that you aren't doing this from your MasterPage , so you might want to try Master.FindControl("Card0") to find this control on the master page.
This space for rent
|
|
|
|
|
I added a
DataGridViewCheckBoxColumn to My Data Grid
Dim DesChkBox As New DataGridViewCheckBoxColumn
DesChkBox.Name = "chbSelect"
DesChkBox.HeaderText = "Select"
DesChkBox.TrueValue = True
DesChkBox.FalseValue = False
grdView.Columns.Add(DesChkBox)
DesChkBox.Width = 50
grdView.ReadOnly = False
grdView.AutoGenerateColumns = False
grdView.RowHeadersWidth = 5
And through a procedure I want to check the Check Box programmatically.
Private Sub prcDefaultSelection()
Try
grdView.Rows(0).Cells(3).Value = True
Catch ex As Exception
MsgBox(Err.Description)
End Try
End Sub
The Check Box is not Checking. Please help me.
|
|
|
|
|
You already posted this in the C# forum. Please do not crosspost.
|
|
|
|
|
Assuming that you are not getting an error message... Quote: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
And assuming that your DataGridView already has 3 columns before you add the checkbox column (you have hard-coded the Checkbox column as being the 4th column, index = 3)...
And assuming that you are actually calling prcDefaultSelection() from somewhere ...
Then this code works.
|
|
|
|
|
Thank you for the response. Yes exactly, I have
3 columns before before the checkbox column.
The procedure prcDefaultSelection() executes well, but the checkbox doesn't get checked. Thats my issue.
Is their any custom events should I need to fire?
|
|
|
|
|
This is working fine for me - the checkbox is being checked. I'm trying this in Windows Forms - are you using a different platform?
|
|
|
|
|
No i m working on Framework 4.5 Plat form only. No working still.
|
|
|
|
|
So windows forms? Not WPF, not ASP?
|
|
|
|
|
Hello !
I have an application in vb.net 2013 , Entity Framework 6 and SQL server 200R2.
I' have finished the Program , but on the client computer , my program use a text based file called MyProg.exe.config , where are several lines .
But I don't like this text file because it's easily modifiable , and someone can change and the result may be a not working program.
Is there any way to not use ths file , and to save the data for example to a binary file that can be modified only from inside my program ?
The actual MyProg.exe.config has this contents :
="1.0"="utf-8"
<configuration>
<configSections>
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</configSections>
<system.diagnostics>
<sources>
<source name="DefaultSource" switchName="DefaultSwitch">
<listeners>
<add name="FileLog" />
</listeners>
</source>
</sources>
<switches>
<add name="DefaultSwitch" value="Information" />
</switches>
<sharedListeners>
<add name="FileLog" type="Microsoft.VisualBasic.Logging.FileLogTraceListener, Microsoft.VisualBasic, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" initializeData="FileLogWriter" />
</sharedListeners>
</system.diagnostics>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0" />
</startup>
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
<parameters>
<parameter value="v11.0" />
</parameters>
</defaultConnectionFactory>
<providers>
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
</providers>
</entityFramework>
<connectionStrings>
<add name="MyEntities" connectionString="metadata=res://*/Model1.csdl|res://*/Model1.ssdl|res://*/Model1.msl;provider=System.Data.SqlClient;provider connection string="data source=USER-PC;initial catalog=DB1;integrated security=True;MultipleActiveResultSets=True;App=EntityFramework"" providerName="System.Data.EntityClient" />
<add name="MyEntities2" connectionString="metadata=res://*/Model2.csdl|res://*/Model2.ssdl|res://*/Model2.msl;provider=System.Data.SqlClient;provider connection string="data source=User-PC;initial catalog=DB2;integrated security=True;MultipleActiveResultSets=True;App=EntityFramework"" providerName="System.Data.EntityClient" />
</connectionStrings>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<probing privatePath="Object" />
</assemblyBinding>
</runtime>
</configuration>
|
|
|
|
|
No, not realy. All of the built in configuration stuff expects the file to be there and in the format it is now.
But first, the Program Files folder, and everything under it, is ReadOnly to normal users. If everyone has admin permissions to their machines (really stupid idea!) then all you're doing is trying to protect the customer from themselves and that's a battle you're never going to win.
You don't have to put everything about your app in the app.config file. You can put all kinds of settings in your application Resources. They will no longer be editable, but the problem is that not even you are going to be able to edit them. You'll have to deploy a new .EXE if you update the settings you put in Resources.
modified 18-Jun-16 8:46am.
|
|
|
|