Automatic picture size setting without macro

BOOBALAN.V
5StarLounger
Posts: 737
Joined: 24 Aug 2017, 07:43

Automatic picture size setting without macro

Post by BOOBALAN.V »

Dear Team,

We want to prepare picture report. When we are inserting picture, we want to change height and width of the picture each and every time to align properly. In our company word macro is disabled due to security reason. Is there any possible way of doing this without macro like picture frame kind of stuff? Please help us. Each photo has its description text box below it. Kindly suggest easy way of doing this without macro.

Kind info: We could do this in excel. Please see the attachment. But as it is report, I couldn't make it all in excel itself, due to page alignment problem will come to user as report have many table and summary content. If we use embedded word document in excel, User cannot convert all the report as PDF in single file. So We decided to make it all in word document. Kindly help us.

Thank you so much for your help.
You do not have the required permissions to view the files attached to this post.

User avatar
HansV
Administrator
Posts: 78393
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Automatic picture size setting without macro

Post by HansV »

Will all the pictures that you want to insert have the same aspect ratio as the sample images in your document? If so, it's fairly simple: right-click one of the sample images and select Change Picture > This Device... from the context menu.

If the picture you select has a different aspect ratio, Word will fit it as best it can.
Best wishes,
Hans

BOOBALAN.V
5StarLounger
Posts: 737
Joined: 24 Aug 2017, 07:43

Re: Automatic picture size setting without macro

Post by BOOBALAN.V »

sorry sir. I might be confused you. we want to use this kind of picture control to allow user to click and insert the picture. But problem is, if we give this picture control, length and width is not uniform for all picture after inserting image. Can we make this uniform height and width sir?
You do not have the required permissions to view the files attached to this post.

User avatar
HansV
Administrator
Posts: 78393
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Automatic picture size setting without macro

Post by HansV »

I don't think that's possible without VBA, sorry.
Best wishes,
Hans

BOOBALAN.V
5StarLounger
Posts: 737
Joined: 24 Aug 2017, 07:43

Re: Automatic picture size setting without macro

Post by BOOBALAN.V »

Thank you for your kind reply sir :thankyou:

User avatar
ChrisGreaves
PlutoniumLounger
Posts: 15585
Joined: 24 Jan 2010, 23:23
Location: brings.slot.perky

Re: Automatic picture size setting without macro

Post by ChrisGreaves »

BOOBALAN.V wrote:
27 May 2022, 05:41
... In our company word macro is disabled due to security reason.... We could do this in excel.
Hello Alan.
Are your macros disabled in Excel?
if macros in Excel can be run, you might be in luck, since you can run any MS application from any other MS application using VBA.
My preferred platform is MSWord, and I have often built and maintained Excel workbooks with my Word2003/VBA macros.
I/you/we could run the Word application (that is, build the word report with picture alignment) by an Excel/VBA application that is programmed to drive MSWord.

If Excel macros are enabled I can send you a simple demonstration of an Excel application building a Word document.
Please let us know.

Cheers, Chris
There's nothing heavier than an empty water bottle

BOOBALAN.V
5StarLounger
Posts: 737
Joined: 24 Aug 2017, 07:43

Re: Automatic picture size setting without macro

Post by BOOBALAN.V »

Thank you so much for your reply sir. Yes sir, we have excel macro enabled. How we can run word by excel sir. Kindly help us sir.

User avatar
Charles Kenyon
5StarLounger
Posts: 609
Joined: 10 Jan 2016, 15:56
Location: Madison, Wisconsin

Re: Automatic picture size setting without macro

Post by Charles Kenyon »

You should be able to put your picture picker content control inside a single-cell table that is set for fixed width.

User avatar
ChrisGreaves
PlutoniumLounger
Posts: 15585
Joined: 24 Jan 2010, 23:23
Location: brings.slot.perky

Re: Automatic picture size setting without macro

Post by ChrisGreaves »

BOOBALAN.V wrote:
27 May 2022, 12:39
Thank you so much for your reply sir. Yes sir, we have excel macro enabled. How we can run word by excel sir. Kindly help us sir.
Hello Alan,
Any non-VBA solution that works is likely to be a better solution than getting into VBA Code, so please try Charles Kenyon's suggestion before mine.

i have attached a very simple Excel2003 workbook that contains two macros.

Let's start by checking that we can indeed write an Excel VBA macro to communicate with MSWord.
Step 1
Run the macro ShowWeCanRunExcelMacros.
You should see a message box appear like this:-
220527_01.png
Step 2
Run the macro ShowWeCanRunMSWord
An instance of MSWord should appear with a new document; the new document should contain some typed text like this:-
220527_02.png
This is very simple code, and you will be responsible for shutting down any extra copies of MSWord and generally taking care of business.
At this stage all we want to know is;-
(a) Can we run Excel VBA program code on the system and
(b) Can we communicate with MSWord on the system.

Cheers, Chris
You do not have the required permissions to view the files attached to this post.
There's nothing heavier than an empty water bottle

User avatar
Jay Freedman
Microsoft MVP
Posts: 1316
Joined: 24 May 2013, 15:33
Location: Warminster, PA

Re: Automatic picture size setting without macro

Post by Jay Freedman »

Charles Kenyon wrote:
27 May 2022, 14:15
You should be able to put your picture picker content control inside a single-cell table that is set for fixed width.
To set a table as "fixed width", go to the Table Layout ribbon. (In the latest versions of Word, it's labeled as just "Layout" but it isn't the Layout tab that's always visible; it's at the far right end of the row when the cursor is in a table). Click the AutoFit button and choose "Fixed Column Width" in the menu.

The table does not have to be a single cell. Here's an example of a 3x3 table with a picture content control in each cell.
1.jpg
You can also change the alignment, for example to center the picture in the cell both vertically and horizontally (this will take effect only if some of the pictures have different aspect ratios, like in the middle row in the picture). And you can put the caption of each picture in the same cell with the picture.
You do not have the required permissions to view the files attached to this post.

jolas
3StarLounger
Posts: 204
Joined: 02 Feb 2010, 23:58

Re: Automatic picture size setting without macro

Post by jolas »

The attached Word docs is possible option you may like to try.

I inserted a shape (curved cornered square) which can have an image as a fill. As shapes can contain text inside much like text boxes and have vertical alignment, I chose to insert content description. Define the square size and have object layout as fix position. Clone and use object alignment to fit number of image I want on the page. Group the (six object) to easily copy the group to other part of the document if needed.

For image fill to scale well it is advisable to have the source image have a square format.
You do not have the required permissions to view the files attached to this post.

User avatar
SpeakEasy
4StarLounger
Posts: 544
Joined: 27 Jun 2021, 10:46

Re: Automatic picture size setting without macro

Post by SpeakEasy »

>In our company word macro is disabled due to security reason
>we have excel macro enabled

I'd be fascinated to understand the logic and justification for this - the risk with macros is the same in Excel as in Word.

User avatar
ChrisGreaves
PlutoniumLounger
Posts: 15585
Joined: 24 Jan 2010, 23:23
Location: brings.slot.perky

Re: Automatic picture size setting without macro

Post by ChrisGreaves »

SpeakEasy wrote:
30 May 2022, 17:43
I'd be fascinated to understand the logic and justification for this - the risk with macros is the same in Excel as in Word.
Back in May 2012, my first year of retirement, an agent contracted me to the CIBC because they were looking for a "Word VBA Wizard".
The project was a disaster for a variety of reasons; the evidence was in the rotating door of the half-dozen contractor positions. The Word Macro and Internet restrictions were crazy; On my third day at work, I walked home to get the laptop from my apartment so that I could use and test procedures from my 2.3MB utility library. Of course, I could not then email the results to myself at CIBC, nor could I use a memory key to transfer them. I printed them on paper and retyped them (at $100/hour or so).

At the five-week mark, CIBC Management got wind of this project using MSWord macros and dropped the axe. I was sent home to work out the two-week notice period from home. (at $100/hour or so).

i learned that CIBC Management was concerned about Word macro viruses.
Right.
I think that the last serious Word macro virus was round about the time of Melissa, around the time Office 97 arrived, with locked projects, distinct from the locked Functions of Word6.0.

It was, too, around the time of the Big Shift. For twenty years the bulk of PC work had been office staff typing memos in MSWord on PCs. A valuable breeding ground for malware. I say 90% of the malware market was MSWord.
Then we got browsers, and suddenly every man and his grandma was sharing photos by email with a nephew in New Zealand, or clicking on links. The malware money dropped right out of MSOffice and went to :fanfare: The Internet :fanfare: , where it remains to this day.

The problem in 2012 was, I believe, with upper management who grew up in the days of MSWord macros and viruses and were not in touch with the times.

Further, the bulk of the malware market was in word processing, rather than in spreadsheets.

Cheers, Chris
There's nothing heavier than an empty water bottle

User avatar
Jay Freedman
Microsoft MVP
Posts: 1316
Joined: 24 May 2013, 15:33
Location: Warminster, PA

Re: Automatic picture size setting without macro

Post by Jay Freedman »

Apparently, the phishing/scamming/ransomware community has returned to the Word VBA area, enough that Microsoft's corporate customers (the only ones they really care about) have pushed the company to put more roadblocks in the way of VBA programmers. This post from a couple of weeks ago notes a change coming to the current versions of Office in the next month or two.
VBA macros are a common way for malicious actors to gain access to deploy malware and ransomware. Therefore, to help improve security in Office, we’re changing the default behavior of Office applications to block macros in files from the internet.

User avatar
ChrisGreaves
PlutoniumLounger
Posts: 15585
Joined: 24 Jan 2010, 23:23
Location: brings.slot.perky

Re: Automatic picture size setting without macro

Post by ChrisGreaves »

Jay Freedman wrote:
31 May 2022, 14:48
... a change coming to the current versions of Office in the next month or two.
So I should stick with Office2003 for the time being, I guess.
...block macros in files from the internet.
Quite right. A recent survey(1) shows that less than one percent of macros arriving via email attachments contained malware :sarcasm:
The Mark of the Web (MOTW) attribute ... only applies to files saved on an NTFS file system, not files saved to FAT32 formatted devices.
So I am OK to keep using the FAT32 DataRam as my browser cache and default download location; that's good news. I love variety, but hate change. :evilgrin:
(1)I inspected the emails that survived Thunderbird's filters and actually made it to my InBox.

:scratch: I have never run an IT installation, but I thought that by now the IT-guys had some sort of filter on the internet cable that ran up from the basement.
Cheers, Chris
P.S. At least my signature this month "Don’t let a good crisis go to waste" has been useful, for once. C.
There's nothing heavier than an empty water bottle

User avatar
SpeakEasy
4StarLounger
Posts: 544
Joined: 27 Jun 2021, 10:46

Re: Automatic picture size setting without macro

Post by SpeakEasy »

>VBA macros are a common way for malicious actors to gain access to deploy malware and ransomware

Yes, but the risk is the same in Word, Excel, Powerpoint, Access. If you fear enough to block Word VBA, then you should block VBA in all the hosts. As you've shown, Microsoft are not favouring any particular product.

Just as a side note, I am not advocating one way or the other here, just pointing out the illogic (for what it is worth I work for a company in a highly sensitive area, and we don't block VBA since our own risk assessment, and that of our various accreditors, is that the benefits of VBA outweigh the risk)

User avatar
SpeakEasy
4StarLounger
Posts: 544
Joined: 27 Jun 2021, 10:46

Re: Automatic picture size setting without macro

Post by SpeakEasy »

> should stick with Office2003

:laugh: Nah - just stay away from Office 365; the changes are only for Office 365 (for now)

>he Mark of the Web (MOTW) attribute
yeah, the MOTW attribute has a surprising number of exemptions ...

User avatar
ChrisGreaves
PlutoniumLounger
Posts: 15585
Joined: 24 Jan 2010, 23:23
Location: brings.slot.perky

Re: Automatic picture size setting without macro

Post by ChrisGreaves »

SpeakEasy wrote:
31 May 2022, 18:09
yeah, the MOTW attribute has a surprising number of exemptions ...
Why will I drift off to sleep tonight trying to align the ASCII codes for M, O, T, and W(1) with the decimal value 666? :weep:
Cheers, Chris
(1) And if that fails, the sums of the Hollerith punched card codes. C

PS For an early example of malware defenses, check out this youtube video at the 2m35s mark.
Chris
There's nothing heavier than an empty water bottle

User avatar
Charles Kenyon
5StarLounger
Posts: 609
Joined: 10 Jan 2016, 15:56
Location: Madison, Wisconsin

Re: Automatic picture size setting without macro

Post by Charles Kenyon »

SpeakEasy wrote:
31 May 2022, 18:09
> should stick with Office2003

:laugh: Nah - just stay away from Office 365; the changes are only for Office 365 (for now)

>he Mark of the Web (MOTW) attribute
yeah, the MOTW attribute has a surprising number of exemptions ...
Most changes like this contaminate the code in updates to Office 2016 and later since they seem to share a code base. It is the flashy things like Design Ideas that get restricted to 365.

BOOBALAN.V
5StarLounger
Posts: 737
Joined: 24 Aug 2017, 07:43

Re: Automatic picture size setting without macro

Post by BOOBALAN.V »

Thank you so much for all your replies. It was very helpful. The same logic i asked with out IT team that why you have disabled only word macro. Because outlook, excel and powerpoint macros are enabled. i am also quite surprise regarding this macro setting only for word document.
However, i have only given picture content control with fixed width column. Somehow user can have some control on picture and it will be easy for them to insert the picture within table cell (at least big picture can not go out of the cell).

Is there any way to set same width and height for different aspect ratio pictures without macro? Kindly help me only this picture width and height setting. So that all pictures will be looking same alignment. it will be helpful.

Once again thank you all. :thankyou: