Link to home
Start Free TrialLog in
Avatar of currentdb
currentdbFlag for Cameroon

asked on

Force GoogleMaps to be visible on the userform

Hi all,

My userform contains a map for any address location. When I send the userform to the printer, the GoogleMaps is not visible on the userform. I know I can print it separately, but is there any way to make it visible on the userform ?

Here is the code for the print button. At least it will print every field on the userform, but I don't know why it does not print the GoogleMaps itself.

Thanks for any help you can provide
Cheers
currentdb
Private Sub btnPrint_Click()
  Me.PrintForm
End Sub

Open in new window

Avatar of SiddharthRout
SiddharthRout
Flag of India image

It works for me. Are you sure there is an image in the image control when you are issuing the command Me.PrintForm?

Sid
Avatar of currentdb

ASKER

Hi Sid,

Yes there's an image in the image control, but it's nowhere to be seen when it's printed on paper. There's not even any white space, nothing. It's like the control is invisible or maybe the printer is blind..:)
Do you have a pdf printer? Try printing it to that? Does it show? If not then upload your workbook here. let me test it.

Sid
Pdf printer = not real printer ? :) no I don't have it.

Sure here's the workbook. I hope your printer is not blind as mine lol
currentdb-v5a.xlsm
No your printer is not blind ;)

You are using a webbrowser and not a Image control as I thought.

Let me have a look at it.

Sid
Ok, the answer to your question lies in the other thread ;)

Use the code that I gave in

https://www.experts-exchange.com/questions/26847470/Print-userform-on-8x14-possible.html?anchorAnswerId=34979343#a34979343

Here is the updated workbook.

I have tested it and it works :)

Sid
Currentdb-v5a.xlsm
Book2.pdf
Yes because I had to use it as per Helen's exemple (was modified by Rory) if you remember the other thread where I mistakenly split my points :)
You are right that works :)

On the other side, I noticed that you inserted the code you already provided in the other question. I was about to insert it along the other code already present in the module, but you were faster than me :)

Is there another way to print it ? Actually if I understand from the printer button, it prints a snapshot of the entire form and that includes the ''X'' (where you can close the form). Is there a way just not to make it visible on the paper ?
I think that is possible as well. Let me check...

Sid
I hope this one is not too complex as the code before (the one that was in the print button), was the easiest one. It was not hard to write a single line :)
ASKER CERTIFIED SOLUTION
Avatar of SiddharthRout
SiddharthRout
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
If the ''Quit'' button remains on the userforms, it makes sense to remove the X.

Just tested it, but ran into a compile error ''Sub not defined'' on the btnPrint. It just highlights this line "Private Sub btnPrint_Click()". I just tried to print and that's why the compile error came in. I looked at the code and everything seems to be ok. Maybe one variable is missing somewhere that was not declared yet.

And
Just remove the line

showTitleBar Me

In Private Sub btnPrint_Click()

Sid
Just answered in the other question lol

About these 2 lines:
ActiveSheet.PageSetup.Orientation = xlLandscape
ActiveWindow.SelectedSheets.PrintOut Copies:=1

Second line PrintOut Copies:=1, are you sure it prints just one copy ? My printer (not blind now lol) just coughed 2 copies instead of one. It's weird because the form does not exceed yet the mininal requirement on the right margins.

First line, ActiveSheet.PageSetup.Orientation = xlLandscape
I'm trying to change so it can print in normal mode (portrait) which means it changes to ActiveSheet.PageSetup.Orientation = xlPortrait ?

It should only print 1 copy. If you see the pdf, there is only one page.

Sid
Yes saw only one pdf page as you mentioned. Now changed it to normal (Portrait). Just to compare between Landscape and Portrait...maybe I have to check the controls somewhere to set the margins to their minimum cause that's why it prints on 2 pages.
Is the 2nd page blank?
No, it's just part of the userform. It's like when you print an Excel worksheet and it exceeds by some margins outside of normal print area.
It's same thing here. Just looked through the code, but there is no any way to set margins to minimum, maybe 0,5 to right and left, same for up and down margins.

If you print a worksheet, you can set these margins as you wish, but in an userform, I don't know how :(
Thank you so much for your help. You should be ranked as great master between the ancient masters like Da Vinci, Aristotle, etc :)