|
99Freddo wrote: Anchor:=ActiveDocument.Paragraphs(1).Range
That's most likely the culprit - you're telling Word to anchor the shape to the first paragraph in the document.
Try changing that to:
Anchor := Selection.Paragraphs(1).Range
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Thanks Richard. I've now got it working the full code is:
Sub zPic()
Dim openDialog As Office.FileDialog
Dim shp As Shape
Dim ils As InlineShape
Set openDialog = Application.FileDialog(msoFileDialogFilePicker)
openDialog.Filters.Clear
openDialog.Filters.Add "JPEG Files", "*.jpg"
openDialog.Filters.Add "Gif Files", "*.gif"
openDialog.Filters.Add "PNG Files", "*.png"
openDialog.Filters.Add "All Files", "*.*"
If openDialog.Show Then
imageName = openDialog.SelectedItems(1)
End If
Set shp = ActiveDocument.Shapes.AddPicture( _
FileName:=imageName, _
SaveWithDocument:=True, _
Anchor:=Selection.Range)
With shp
.WrapFormat.Type = wdWrapTight
.RelativeVerticalPosition = wdRelativeVerticalPositionMargin
.RelativeHorizontalPosition = wdRelativeHorizontalPositionMargin
.Left = wdFrameRight
End With
End Sub
|
|
|
|
|
In a change to a .net 2010 application that uses a sql server 2012 database, I am thinking of using a trigger when a duplicate record has been generated. This trigger would send outlook 2013 or office 365 email message to selected users. I am thinking of doing this instead of having the duplicate record email message sent out in the .net application. Thus would you show me the code and/or point me to a url that will show me how to accomplish my goal?
|
|
|
|
|
You should know by now that "show me the code" does not work here.
As SQL Server is a SERVER application and Office is a CLIENT application you are not going to be able to do as you require unless you install Office on your server (not sure this can even be done!).
From the server you need to use SMTP for SQL server to send mail notifications.
Sending a notification that a duplicate record has been created indicates you have a badly designed database. Duplicates should be dealt with either before or during the insert, NEVER after insert.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
The SQL server can send mail directly if you have Database mail configured, but it does not uses Outlook or Webmail. This can be done from a trigger, agen job or procedure
email - Send e-mail from a trigger - Stack Overflow[^]
=========================================================
I'm an optoholic - my glass is always half full of vodka.
=========================================================
|
|
|
|
|
In an existing vb.net 2010 application, I would like to create an email message for selected users using outlook 2013 and/or webmail that is supported by office 365. This email message would be generated when a user clicks a button to have a 'letter' generated. This email message would be generated when duplicate rec ords are located in the sql server 2012 database. The duplicate records should not occur in 99% of the cases but there is a chance the duplicate record can happen.
Thus would you show me the code on how to generate this email message?
|
|
|
|
|
|
Hello !
I have a sql server database ( the model ).
I have another sql server database.
I want to compare the second database with the model , and after to update the database structure in order to be equal with the model.
Is there any way to do this with VB.net
Thank you !
|
|
|
|
|
Yes but it is probably beyond your skill set at the moment. You might want to get SQL Compare from Red-Gate to give you an idea of the scope of this requirement. Red-Gate is not free but they are good, you might find some free tools to do a similar job, you might search Free Tools Discussion Boards[^]
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
I don't want a tool to make this work.
I know the redgate sql compare. But I think this tool work as a standalone program.
I need a library or a way to do this through code inside my vb.net program.
|
|
|
|
|
|
Thank you , but I'm not using Entity Framework on my program.
Do you think I can use this only for comparing databases and reflect changes ?
|
|
|
|
|
Have some google foo[^] it looks like there are quite a few examples there, even one from CP.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
You can automate this with SQL Compare within a VB.NET program. There is a Compare SDK that can be embedded into an application.
SQL Comparison SDK - Automates Comparison And Synchronization Tasks[^]
The process of comparing two tables and generating difference code isn't hard, but it does become tedious as there are a lot of potential issues to work through. If you have lots of time to build this, then you can use data from sys.columns and other DMVs to generate difference lists and build the ALTER statements for tables.
For views/procs/functions, it's more complex comparing changes, but really if you have a model, you can just take the code and move it over.
|
|
|
|
|
Hello !
Using vb.net , how can I search and list the sql server instances running on local Pc and on local network ?
For each sql server instance I need to know the server name and database instance name.
Thank you !
|
|
|
|
|
|
Thank you !
But , is this going to work with other version of sql server for example 2012 , 2014 or 2016 ?
|
|
|
|
|
|
Yes I've tried it.
But on my Pc i have sql server 2008. On network i have sql server 2014 and 2016.
The code only work for sql server 2008 . Does not work for Sql server 2014 and 2016.
|
|
|
|
|
|
Yes , does not work with sql server 2014 and 2016.
|
|
|
|
|
Hello !
I have a vb.net 2003 application.
I have a form when users can upload images ( .jpg ) from files or from scanners. When a image is inserted , a link is kept in a database as a record.
I want to keep this uploaded images in a format that can be opened only from my application and not by windows explorer.
Is there anything I can do ?
Thank you !
|
|
|
|
|
Encrypting the file content seems to be the very obvious choice.
You'll have to decrypt the content, of course, when you want to show these images.
|
|
|
|
|
Can you suggest to me an encrypting library that I can use or something else ?
( And to better clarify what I want , when the user upload the file , I want to save this file in some folder , but the user should not be able to open this file from windows explorer or from other programs, but only when he try to open from within my application )
|
|
|
|
|
Like hijacking the data?
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|